Chromium Code Reviews| Index: webrtc/call/call.cc |
| diff --git a/webrtc/call/call.cc b/webrtc/call/call.cc |
| index 3fd7a931d0cecc88cff0b30a47557db5a21ed586..88ee67fca3c4ab8af723b65141b3bd1bea0bedb3 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 { |
| @@ -207,8 +210,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()) { |
| @@ -219,10 +223,15 @@ 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 |
| + ? *config_.bitrate_config.max_bitrate_bps |
| + : -1); |
| 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(); |
| @@ -531,8 +540,8 @@ 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 || |
| @@ -544,9 +553,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); |
|
stefan-webrtc
2016/03/18 08:28:40
Can't we do the same thing on line 229?
pthatcher1
2016/03/18 16:45:15
+1
skvlad
2016/03/18 18:01:52
Done. Sorry, missed this.
|
| congestion_controller_->SetBweBitrates(bitrate_config.min_bitrate_bps, |
| bitrate_config.start_bitrate_bps, |
| - bitrate_config.max_bitrate_bps); |
| + bwe_max_bitrate); |
| } |
| void Call::SignalNetworkState(NetworkState state) { |