Chromium Code Reviews| Index: webrtc/call/call.cc |
| diff --git a/webrtc/call/call.cc b/webrtc/call/call.cc |
| index 3fd7a931d0cecc88cff0b30a47557db5a21ed586..7ae0b1c22053f3d41325cf6fd42ebd3dc7d21de7 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); |
|
Taylor Brandstetter
2016/03/29 02:26:58
Is a max of 0 not allowed?
skvlad
2016/03/30 19:40:44
No. The bitrate limit must be positive or unset. T
|
| + RTC_DCHECK_GE(*config.bitrate_config.max_bitrate_bps, |
| config.bitrate_config.start_bitrate_bps); |
| } |
| if (config.audio_state.get()) { |
| @@ -219,10 +223,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(); |
| @@ -531,8 +539,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) |
|
Taylor Brandstetter
2016/03/29 02:26:58
nit: as long as you're modifying this line, might
skvlad
2016/03/30 19:40:44
Done.
|
| + 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 +552,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::SignalNetworkState(NetworkState state) { |