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

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

Issue 2534173002: Wire up x-google-{min,start,max}-bitrate to WebRtcVoiceMediaChannel. (Closed)
Patch Set: Clean up comment. Created 4 years, 1 month 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 | « webrtc/media/engine/webrtcvoiceengine.h ('k') | webrtc/media/engine/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/engine/webrtcvoiceengine.cc
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc
index 96f9ed70d403c6c464cc9b015f83190630a0b331..69b9134d3a066322a19404e89db4d1e7155bdb5e 100644
--- a/webrtc/media/engine/webrtcvoiceengine.cc
+++ b/webrtc/media/engine/webrtcvoiceengine.cc
@@ -277,6 +277,32 @@ void GetOpusConfig(const AudioCodec& codec,
voe_codec->rate = GetOpusBitrate(codec, *max_playback_rate);
}
+webrtc::Call::Config::BitrateConfig GetBitrateConfigForCodec(
+ const AudioCodec& codec) {
+ webrtc::Call::Config::BitrateConfig config;
+ int bitrate_kbps;
the sun 2016/11/30 11:22:27 nit: always default init
stefan-webrtc 2016/11/30 11:44:42 Done.
+ if (codec.GetParam(kCodecParamMinBitrate, &bitrate_kbps) &&
+ bitrate_kbps > 0) {
+ config.min_bitrate_bps = bitrate_kbps * 1000;
+ } else {
+ config.min_bitrate_bps = 0;
+ }
+ if (codec.GetParam(kCodecParamStartBitrate, &bitrate_kbps) &&
+ bitrate_kbps > 0) {
+ config.start_bitrate_bps = bitrate_kbps * 1000;
+ } else {
+ // Do not reconfigure start bitrate unless it's specified and positive.
+ config.start_bitrate_bps = -1;
the sun 2016/11/30 11:22:27 Change the optional fields in the config to use rt
stefan-webrtc 2016/11/30 11:44:42 I'd prefer making interface changes later.
+ }
+ if (codec.GetParam(kCodecParamMaxBitrate, &bitrate_kbps) &&
+ bitrate_kbps > 0) {
+ config.max_bitrate_bps = bitrate_kbps * 1000;
+ } else {
+ config.max_bitrate_bps = -1;
+ }
+ return config;
+}
+
webrtc::AudioState::Config MakeAudioStateConfig(VoEWrapper* voe_wrapper) {
webrtc::AudioState::Config config;
config.voice_engine = voe_wrapper->engine();
@@ -1616,6 +1642,15 @@ bool WebRtcVoiceMediaChannel::SetSendParameters(
return false;
}
+ if (params.max_bandwidth_bps >= 0) {
the sun 2016/11/30 11:22:27 Is this logic the same for video? Does it make sen
stefan-webrtc 2016/11/30 11:44:43 It is the same, not sure about making it a util th
+ // Note that max_bandwidth_bps intentionally takes priority over the
+ // bitrate config for the codec. This allows FEC to be applied above the
minyue-webrtc 2016/11/29 22:10:55 Not sure about the reasoning on FEC in the comment
stefan-webrtc 2016/11/30 11:44:43 I made it a bit more generic.
+ // codec target bitrate.
+ bitrate_config_.max_bitrate_bps =
+ params.max_bandwidth_bps == 0 ? -1 : params.max_bandwidth_bps;
+ }
+ call_->SetBitrateConfig(bitrate_config_);
+
if (!ValidateRtpExtensions(params.extensions)) {
return false;
}
@@ -1933,6 +1968,13 @@ bool WebRtcVoiceMediaChannel::SetSendCodecs(
&send_codec_spec.max_ptime_ms);
}
+ bitrate_config_ = GetBitrateConfigForCodec(*codec);
+ if (send_codec_spec_set_ && send_codec_spec == send_codec_spec_) {
minyue-webrtc 2016/11/29 22:10:55 I don't think this is the place we reset codec. pl
the sun 2016/11/30 11:22:27 I don't get the logic involving send_codec_spec_se
stefan-webrtc 2016/11/30 11:44:42 I tried to the changes into WebRtcAudioSendStream
stefan-webrtc 2016/11/30 11:44:43 I don't think the send_codec_spec_set_ check is ne
+ // 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;
+ }
+
// Set packet size if the AudioCodec param kCodecParamPTime is set.
int ptime_ms = 0;
if (codec->GetParam(kCodecParamPTime, &ptime_ms)) {
@@ -1990,6 +2032,7 @@ bool WebRtcVoiceMediaChannel::SetSendCodecs(
// Apply new settings to all streams.
if (send_codec_spec_ != send_codec_spec) {
send_codec_spec_ = std::move(send_codec_spec);
+ send_codec_spec_set_ = true;
for (const auto& kv : send_streams_) {
kv.second->RecreateAudioSendStream(send_codec_spec_);
}
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.h ('k') | webrtc/media/engine/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698