Index: webrtc/call/call.cc |
diff --git a/webrtc/call/call.cc b/webrtc/call/call.cc |
index 91c27c80ad99f16805b80ad45b2916c60812748d..c7957e696d360d77356c05f9a6d36d7aabc7151c 100644 |
--- a/webrtc/call/call.cc |
+++ b/webrtc/call/call.cc |
@@ -47,6 +47,9 @@ |
namespace webrtc { |
const int Call::Config::kDefaultStartBitrateBps = 300000; |
+// Indicates to the bandwidth estimator that there is no upper cap on the |
+// estimated bitrate. |
+static const int kBitrateUnlimited = -1; |
namespace internal { |
@@ -211,8 +214,9 @@ Call::Call(const Call::Config& config) |
RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); |
RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps, |
config.bitrate_config.min_bitrate_bps); |
- if (config.bitrate_config.max_bitrate_bps != -1) { |
- RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, |
+ if (config.bitrate_config.max_bitrate_bps) { |
+ RTC_DCHECK_GT(*config.bitrate_config.max_bitrate_bps, 0); |
+ RTC_DCHECK_GE(*config.bitrate_config.max_bitrate_bps, |
config.bitrate_config.start_bitrate_bps); |
} |
if (config.audio_state.get()) { |
@@ -223,10 +227,14 @@ Call::Call(const Call::Config& config) |
Trace::CreateTrace(); |
call_stats_->RegisterStatsObserver(congestion_controller_.get()); |
+ // The congestion controller uses -1 to represent unlimited bitrate. |
+ // TODO(skvlad): Remove this conversion when congestion controller code |
+ // is updated to use rtc::Optional. |
+ int bwe_max_bitrate = |
+ config_.bitrate_config.max_bitrate_bps.value_or(kBitrateUnlimited); |
congestion_controller_->SetBweBitrates( |
config_.bitrate_config.min_bitrate_bps, |
- config_.bitrate_config.start_bitrate_bps, |
- config_.bitrate_config.max_bitrate_bps); |
+ config_.bitrate_config.start_bitrate_bps, bwe_max_bitrate); |
congestion_controller_->GetBitrateController()->SetEventLog(event_log_); |
module_process_thread_->Start(); |
@@ -537,8 +545,9 @@ void Call::SetBitrateConfig( |
TRACE_EVENT0("webrtc", "Call::SetBitrateConfig"); |
RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
RTC_DCHECK_GE(bitrate_config.min_bitrate_bps, 0); |
- if (bitrate_config.max_bitrate_bps != -1) |
- RTC_DCHECK_GT(bitrate_config.max_bitrate_bps, 0); |
+ if (bitrate_config.max_bitrate_bps) { |
+ RTC_DCHECK_GT(*bitrate_config.max_bitrate_bps, 0); |
+ } |
if (config_.bitrate_config.min_bitrate_bps == |
bitrate_config.min_bitrate_bps && |
(bitrate_config.start_bitrate_bps <= 0 || |
@@ -550,9 +559,14 @@ void Call::SetBitrateConfig( |
return; |
} |
config_.bitrate_config = bitrate_config; |
+ // The congestion controller uses -1 to represent unlimited bitrate. |
+ // TODO(skvlad): Remove this conversion when congestion controller code |
+ // is updated to use rtc::Optional. |
+ int bwe_max_bitrate = |
+ bitrate_config.max_bitrate_bps.value_or(kBitrateUnlimited); |
congestion_controller_->SetBweBitrates(bitrate_config.min_bitrate_bps, |
bitrate_config.start_bitrate_bps, |
- bitrate_config.max_bitrate_bps); |
+ bwe_max_bitrate); |
} |
void Call::SignalChannelNetworkState(MediaType media, NetworkState state) { |