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

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: Make "b=AS" take priority over "x-google-max-bitrate" for BWE max bitrate. 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
« no previous file with comments | « no previous file | webrtc/media/engine/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/engine/webrtcvideoengine2.cc
diff --git a/webrtc/media/engine/webrtcvideoengine2.cc b/webrtc/media/engine/webrtcvideoengine2.cc
index 46b033e4f2d08cc0074208717dda53a9f62df5f1..c19c78f67c9644f5a1f9237fdbb03c22f5c2ac4a 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,38 @@ 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(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;
+ if (changed_params.codec || changed_params.max_bandwidth_bps) {
+ if (send_codec_) {
+ // TODO(holmer): Changing the codec parameters shouldn't necessarily mean
+ // that we change the min/max of bandwidth estimation. Reevaluate this.
+ bitrate_config_ = GetBitrateConfigForCodec(send_codec_->codec);
+ 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;
+ }
+ }
+ if (params.max_bandwidth_bps >= 0) {
+ // Note that max_bandwidth_bps intentionally takes priority over the
+ // bitrate config for the codec. This allows FEC to be applied above the
+ // codec target bitrate.
+ // TODO(pbos): Figure out whether b=AS means max bitrate for this
stefan-webrtc 2016/04/27 07:24:41 b=AS means session bandwidth, so my interpretation
+ // 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.
+ bitrate_config_.max_bitrate_bps =
+ params.max_bandwidth_bps == 0 ? -1 : params.max_bandwidth_bps;
}
- bitrate_config_changed = true;
- }
-
- if (bitrate_config_changed) {
call_->SetBitrateConfig(bitrate_config_);
}
« no previous file with comments | « no previous file | webrtc/media/engine/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698