Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(937)

Unified Diff: webrtc/media/engine/webrtcvideoengine2.cc

Issue 1904063003: Fixing the interaction between codec bitrate limit and "b=AS". (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/media/engine/webrtcvideoengine2.cc
diff --git a/webrtc/media/engine/webrtcvideoengine2.cc b/webrtc/media/engine/webrtcvideoengine2.cc
index 46b033e4f2d08cc0074208717dda53a9f62df5f1..1d20252253feaf96ce60c5ed151924e19615fda5 100644
--- a/webrtc/media/engine/webrtcvideoengine2.cc
+++ b/webrtc/media/engine/webrtcvideoengine2.cc
@@ -770,7 +770,7 @@ bool WebRtcVideoChannel2::GetChangedSendParameters(
}
// Handle max bitrate.
- if (params.max_bandwidth_bps != bitrate_config_.max_bitrate_bps &&
+ if (params.max_bandwidth_bps != send_params_.max_bandwidth_bps &&
params.max_bandwidth_bps >= 0) {
// 0 uncaps max bitrate (-1).
changed_params->max_bandwidth_bps = rtc::Optional<int>(
@@ -805,39 +805,37 @@ bool WebRtcVideoChannel2::SetSendParameters(const VideoSendParameters& params) {
return false;
}
- bool bitrate_config_changed = false;
-
if (changed_params.codec) {
const VideoCodecSettings& codec_settings = *changed_params.codec;
send_codec_ = rtc::Optional<VideoCodecSettings>(codec_settings);
-
LOG(LS_INFO) << "Using codec: " << codec_settings.codec.ToString();
- // TODO(holmer): Changing the codec parameters shouldn't necessarily mean
- // that we change the min/max of bandwidth estimation. Reevaluate this.
- bitrate_config_ = GetBitrateConfigForCodec(codec_settings.codec);
- bitrate_config_changed = true;
}
if (changed_params.rtp_header_extensions) {
send_rtp_extensions_ = *changed_params.rtp_header_extensions;
}
- if (changed_params.max_bandwidth_bps) {
+ // TODO(holmer): Changing the codec parameters shouldn't necessarily mean
+ // that we change the min/max of bandwidth estimation. Reevaluate this.
+ if (changed_params.codec || changed_params.max_bandwidth_bps) {
+ if (send_codec_) {
+ bitrate_config_ = GetBitrateConfigForCodec(send_codec_->codec);
+ }
// TODO(pbos): Figure out whether b=AS means max bitrate for this
// WebRtcVideoChannel2 (in which case we're good), or per sender (SSRC), in
// which case this should not set a Call::BitrateConfig but rather
// reconfigure all senders.
- int max_bitrate_bps = *changed_params.max_bandwidth_bps;
- bitrate_config_.start_bitrate_bps = -1;
- bitrate_config_.max_bitrate_bps = max_bitrate_bps;
- if (max_bitrate_bps > 0 &&
- bitrate_config_.min_bitrate_bps > max_bitrate_bps) {
- bitrate_config_.min_bitrate_bps = max_bitrate_bps;
+ int max_bandwidth_bps =
+ params.max_bandwidth_bps == 0 ? -1 : params.max_bandwidth_bps;
+ bitrate_config_.max_bitrate_bps =
+ send_codec_
+ ? MinNonNegative(bitrate_config_.max_bitrate_bps, max_bandwidth_bps)
+ : max_bandwidth_bps;
+ if (!changed_params.codec) {
+ // If the codec isn't changing, set the start bitrate to -1 which means
+ // "unchanged" so that BWE isn't affected.
+ bitrate_config_.start_bitrate_bps = -1;
}
- bitrate_config_changed = true;
- }
-
- if (bitrate_config_changed) {
call_->SetBitrateConfig(bitrate_config_);
}

Powered by Google App Engine
This is Rietveld 408576698