Index: webrtc/call/call.cc |
diff --git a/webrtc/call/call.cc b/webrtc/call/call.cc |
index 3fd7a931d0cecc88cff0b30a47557db5a21ed586..bede1964b3d835f319d5d8477c77fb601bc668c2 100644 |
--- a/webrtc/call/call.cc |
+++ b/webrtc/call/call.cc |
@@ -207,8 +207,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 +220,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( |
pthatcher1
2016/03/17 21:51:28
Can you make the -1 a named constant, perhaps kBan
skvlad
2016/03/18 00:49:17
Done.
|
config_.bitrate_config.min_bitrate_bps, |
pthatcher1
2016/03/17 21:51:28
This could be more clear by using optional:: value
skvlad
2016/03/18 00:49:17
Done. I didn't notice this very convenient method
|
- 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 +537,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 +550,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 ? *bitrate_config.max_bitrate_bps : -1); |
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) { |