// Returns its smallest positive argument. If neither argument is positive, // returns an arbitrary nonpositive value.
int MinPositive(int a, int b) {
if (a <= 0) { return b;
}
if (b <= 0) { return a;
} return std::min(a, b);
}
std::optional<int> new_start; // Only update the "start" bitrate if it's set, and different from the old // value. In practice, this value comes from the x-google-start-bitrate codec // parameter in SDP, and setting the same remote description twice shouldn't // restart bandwidth estimation.
if (bitrate_config.start_bitrate_bps != -1 &&
bitrate_config.start_bitrate_bps !=
base_bitrate_config_.start_bitrate_bps) {
new_start.emplace(bitrate_config.start_bitrate_bps);
}
base_bitrate_config_ = bitrate_config; return UpdateConstraints(new_start);
}
// If the combined min ends up greater than the combined max, the max takes // priority.
if (updated.max_bitrate_bps != -1 &&
updated.min_bitrate_bps > updated.max_bitrate_bps) {
updated.min_bitrate_bps = updated.max_bitrate_bps;
}
// If there is nothing to update (min/max unchanged, no new bandwidth // estimation start value), return early.
if (updated.min_bitrate_bps == bitrate_config_.min_bitrate_bps &&
updated.max_bitrate_bps == bitrate_config_.max_bitrate_bps &&
!new_start) { return std::nullopt;
}
if (new_start) { // Clamp start by min and max.
updated.start_bitrate_bps = MinPositive(
std::max(*new_start, updated.min_bitrate_bps), updated.max_bitrate_bps);
} else {
updated.start_bitrate_bps = -1;
}
BitrateConstraints config_to_return = updated;
if (!new_start) {
updated.start_bitrate_bps = bitrate_config_.start_bitrate_bps;
}
bitrate_config_ = updated; return config_to_return;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.