Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 first_packet_sent_ms_(-1), | 200 first_packet_sent_ms_(-1), |
| 201 estimated_send_bitrate_sum_kbits_(0), | 201 estimated_send_bitrate_sum_kbits_(0), |
| 202 pacer_bitrate_sum_kbits_(0), | 202 pacer_bitrate_sum_kbits_(0), |
| 203 num_bitrate_updates_(0), | 203 num_bitrate_updates_(0), |
| 204 remb_(clock_), | 204 remb_(clock_), |
| 205 congestion_controller_(new CongestionController(clock_, this, &remb_)) { | 205 congestion_controller_(new CongestionController(clock_, this, &remb_)) { |
| 206 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 206 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 207 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); | 207 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); |
| 208 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps, | 208 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps, |
| 209 config.bitrate_config.min_bitrate_bps); | 209 config.bitrate_config.min_bitrate_bps); |
| 210 if (config.bitrate_config.max_bitrate_bps != -1) { | 210 if (config.bitrate_config.max_bitrate_bps) { |
| 211 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, | 211 RTC_DCHECK_GT(*config.bitrate_config.max_bitrate_bps, 0); |
| 212 RTC_DCHECK_GE(*config.bitrate_config.max_bitrate_bps, | |
| 212 config.bitrate_config.start_bitrate_bps); | 213 config.bitrate_config.start_bitrate_bps); |
| 213 } | 214 } |
| 214 if (config.audio_state.get()) { | 215 if (config.audio_state.get()) { |
| 215 ScopedVoEInterface<VoECodec> voe_codec(voice_engine()); | 216 ScopedVoEInterface<VoECodec> voe_codec(voice_engine()); |
| 216 event_log_ = voe_codec->GetEventLog(); | 217 event_log_ = voe_codec->GetEventLog(); |
| 217 } | 218 } |
| 218 | 219 |
| 219 Trace::CreateTrace(); | 220 Trace::CreateTrace(); |
| 220 call_stats_->RegisterStatsObserver(congestion_controller_.get()); | 221 call_stats_->RegisterStatsObserver(congestion_controller_.get()); |
| 221 | 222 |
| 223 // The congestion controller uses -1 to represent unlimited bitrate. | |
| 224 // TODO(skvlad): Remove this conversion when congestion controller code | |
| 225 // is updated to use rtc::Optional. | |
| 226 int bwe_max_bitrate = (config_.bitrate_config.max_bitrate_bps | |
| 227 ? *config_.bitrate_config.max_bitrate_bps | |
| 228 : -1); | |
| 222 congestion_controller_->SetBweBitrates( | 229 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.
| |
| 223 config_.bitrate_config.min_bitrate_bps, | 230 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
| |
| 224 config_.bitrate_config.start_bitrate_bps, | 231 config_.bitrate_config.start_bitrate_bps, bwe_max_bitrate); |
| 225 config_.bitrate_config.max_bitrate_bps); | |
| 226 congestion_controller_->GetBitrateController()->SetEventLog(event_log_); | 232 congestion_controller_->GetBitrateController()->SetEventLog(event_log_); |
| 227 | 233 |
| 228 module_process_thread_->Start(); | 234 module_process_thread_->Start(); |
| 229 module_process_thread_->RegisterModule(call_stats_.get()); | 235 module_process_thread_->RegisterModule(call_stats_.get()); |
| 230 module_process_thread_->RegisterModule(congestion_controller_.get()); | 236 module_process_thread_->RegisterModule(congestion_controller_.get()); |
| 231 pacer_thread_->RegisterModule(congestion_controller_->pacer()); | 237 pacer_thread_->RegisterModule(congestion_controller_->pacer()); |
| 232 pacer_thread_->RegisterModule( | 238 pacer_thread_->RegisterModule( |
| 233 congestion_controller_->GetRemoteBitrateEstimator(true)); | 239 congestion_controller_->GetRemoteBitrateEstimator(true)); |
| 234 pacer_thread_->Start(); | 240 pacer_thread_->Start(); |
| 235 } | 241 } |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 524 stats.pacer_delay_ms = congestion_controller_->GetPacerQueuingDelayMs(); | 530 stats.pacer_delay_ms = congestion_controller_->GetPacerQueuingDelayMs(); |
| 525 stats.rtt_ms = call_stats_->rtcp_rtt_stats()->LastProcessedRtt(); | 531 stats.rtt_ms = call_stats_->rtcp_rtt_stats()->LastProcessedRtt(); |
| 526 return stats; | 532 return stats; |
| 527 } | 533 } |
| 528 | 534 |
| 529 void Call::SetBitrateConfig( | 535 void Call::SetBitrateConfig( |
| 530 const webrtc::Call::Config::BitrateConfig& bitrate_config) { | 536 const webrtc::Call::Config::BitrateConfig& bitrate_config) { |
| 531 TRACE_EVENT0("webrtc", "Call::SetBitrateConfig"); | 537 TRACE_EVENT0("webrtc", "Call::SetBitrateConfig"); |
| 532 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 538 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 533 RTC_DCHECK_GE(bitrate_config.min_bitrate_bps, 0); | 539 RTC_DCHECK_GE(bitrate_config.min_bitrate_bps, 0); |
| 534 if (bitrate_config.max_bitrate_bps != -1) | 540 if (bitrate_config.max_bitrate_bps) |
| 535 RTC_DCHECK_GT(bitrate_config.max_bitrate_bps, 0); | 541 RTC_DCHECK_GT(*bitrate_config.max_bitrate_bps, 0); |
| 536 if (config_.bitrate_config.min_bitrate_bps == | 542 if (config_.bitrate_config.min_bitrate_bps == |
| 537 bitrate_config.min_bitrate_bps && | 543 bitrate_config.min_bitrate_bps && |
| 538 (bitrate_config.start_bitrate_bps <= 0 || | 544 (bitrate_config.start_bitrate_bps <= 0 || |
| 539 config_.bitrate_config.start_bitrate_bps == | 545 config_.bitrate_config.start_bitrate_bps == |
| 540 bitrate_config.start_bitrate_bps) && | 546 bitrate_config.start_bitrate_bps) && |
| 541 config_.bitrate_config.max_bitrate_bps == | 547 config_.bitrate_config.max_bitrate_bps == |
| 542 bitrate_config.max_bitrate_bps) { | 548 bitrate_config.max_bitrate_bps) { |
| 543 // Nothing new to set, early abort to avoid encoder reconfigurations. | 549 // Nothing new to set, early abort to avoid encoder reconfigurations. |
| 544 return; | 550 return; |
| 545 } | 551 } |
| 546 config_.bitrate_config = bitrate_config; | 552 config_.bitrate_config = bitrate_config; |
| 553 // The congestion controller uses -1 to represent unlimited bitrate. | |
| 554 // TODO(skvlad): Remove this conversion when congestion controller code | |
| 555 // is updated to use rtc::Optional. | |
| 556 int bwe_max_bitrate = | |
| 557 (bitrate_config.max_bitrate_bps ? *bitrate_config.max_bitrate_bps : -1); | |
| 547 congestion_controller_->SetBweBitrates(bitrate_config.min_bitrate_bps, | 558 congestion_controller_->SetBweBitrates(bitrate_config.min_bitrate_bps, |
| 548 bitrate_config.start_bitrate_bps, | 559 bitrate_config.start_bitrate_bps, |
| 549 bitrate_config.max_bitrate_bps); | 560 bwe_max_bitrate); |
| 550 } | 561 } |
| 551 | 562 |
| 552 void Call::SignalNetworkState(NetworkState state) { | 563 void Call::SignalNetworkState(NetworkState state) { |
| 553 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 564 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 554 network_enabled_ = state == kNetworkUp; | 565 network_enabled_ = state == kNetworkUp; |
| 555 congestion_controller_->SignalNetworkState(state); | 566 congestion_controller_->SignalNetworkState(state); |
| 556 { | 567 { |
| 557 ReadLockScoped write_lock(*send_crit_); | 568 ReadLockScoped write_lock(*send_crit_); |
| 558 for (auto& kv : audio_send_ssrcs_) { | 569 for (auto& kv : audio_send_ssrcs_) { |
| 559 kv.second->SignalNetworkState(state); | 570 kv.second->SignalNetworkState(state); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 745 // thread. Then this check can be enabled. | 756 // thread. Then this check can be enabled. |
| 746 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); | 757 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); |
| 747 if (RtpHeaderParser::IsRtcp(packet, length)) | 758 if (RtpHeaderParser::IsRtcp(packet, length)) |
| 748 return DeliverRtcp(media_type, packet, length); | 759 return DeliverRtcp(media_type, packet, length); |
| 749 | 760 |
| 750 return DeliverRtp(media_type, packet, length, packet_time); | 761 return DeliverRtp(media_type, packet, length, packet_time); |
| 751 } | 762 } |
| 752 | 763 |
| 753 } // namespace internal | 764 } // namespace internal |
| 754 } // namespace webrtc | 765 } // namespace webrtc |
| OLD | NEW |