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 14 matching lines...) Expand all Loading... | |
25 #include "webrtc/base/constructormagic.h" | 25 #include "webrtc/base/constructormagic.h" |
26 #include "webrtc/base/logging.h" | 26 #include "webrtc/base/logging.h" |
27 #include "webrtc/base/optional.h" | 27 #include "webrtc/base/optional.h" |
28 #include "webrtc/base/task_queue.h" | 28 #include "webrtc/base/task_queue.h" |
29 #include "webrtc/base/thread_annotations.h" | 29 #include "webrtc/base/thread_annotations.h" |
30 #include "webrtc/base/thread_checker.h" | 30 #include "webrtc/base/thread_checker.h" |
31 #include "webrtc/base/trace_event.h" | 31 #include "webrtc/base/trace_event.h" |
32 #include "webrtc/call/bitrate_allocator.h" | 32 #include "webrtc/call/bitrate_allocator.h" |
33 #include "webrtc/call/call.h" | 33 #include "webrtc/call/call.h" |
34 #include "webrtc/call/flexfec_receive_stream_impl.h" | 34 #include "webrtc/call/flexfec_receive_stream_impl.h" |
35 #include "webrtc/call/rtp_transport_controller.h" | |
35 #include "webrtc/config.h" | 36 #include "webrtc/config.h" |
36 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 37 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
37 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 38 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
38 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" | 39 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" |
39 #include "webrtc/modules/pacing/paced_sender.h" | 40 #include "webrtc/modules/pacing/paced_sender.h" |
40 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" | 41 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" |
41 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 42 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
42 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 43 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
43 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" | 44 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" |
44 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" | 45 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 } | 80 } |
80 | 81 |
81 bool UseSendSideBwe(const AudioReceiveStream::Config& config) { | 82 bool UseSendSideBwe(const AudioReceiveStream::Config& config) { |
82 return UseSendSideBwe(config.rtp.extensions, config.rtp.transport_cc); | 83 return UseSendSideBwe(config.rtp.extensions, config.rtp.transport_cc); |
83 } | 84 } |
84 | 85 |
85 bool UseSendSideBwe(const FlexfecReceiveStream::Config& config) { | 86 bool UseSendSideBwe(const FlexfecReceiveStream::Config& config) { |
86 return UseSendSideBwe(config.rtp_header_extensions, config.transport_cc); | 87 return UseSendSideBwe(config.rtp_header_extensions, config.transport_cc); |
87 } | 88 } |
88 | 89 |
90 class RtpTransportController : public RtpTransportControllerSendInterface { | |
stefan-webrtc
2017/02/17 11:59:28
Maybe create a new file for this already?
nisse-webrtc
2017/02/17 12:35:14
Could do that. Then I'd need to declare it (or at
| |
91 public: | |
92 RtpTransportController(Clock* clock, webrtc::RtcEventLog* event_log); | |
93 void InitCongestionControl(CongestionController::Observer* observer); | |
94 VieRemb* remb() override { return &remb_; } | |
95 PacketRouter* packet_router() override { return &packet_router_; } | |
96 CongestionController* congestion_controller() override { | |
97 return congestion_controller_.get(); | |
98 } | |
99 | |
100 private: | |
101 Clock* const clock_; | |
102 webrtc::RtcEventLog* const event_log_; | |
103 VieRemb remb_; | |
104 PacketRouter packet_router_; | |
105 // Construction delayed until InitCongestionControl, since the | |
106 // CongestionController wants its observer as a construction time | |
107 // argument, and setting it later seems no-trivial. | |
stefan-webrtc
2017/02/17 11:59:28
Doesn't this just mean that we're creating the Rtp
nisse-webrtc
2017/02/17 12:35:14
That would make sense for now, but longer term, I
| |
108 std::unique_ptr<CongestionController> congestion_controller_; | |
109 }; | |
110 | |
111 RtpTransportController::RtpTransportController(Clock* clock, | |
112 webrtc::RtcEventLog* event_log) | |
113 : clock_(clock), event_log_(event_log), remb_(clock) {} | |
114 | |
115 void RtpTransportController::InitCongestionControl( | |
116 CongestionController::Observer* observer) { | |
117 // Must be called only once. | |
118 RTC_CHECK(!congestion_controller_); | |
119 congestion_controller_.reset(new CongestionController( | |
120 clock_, observer, &remb_, event_log_, &packet_router_)); | |
121 } | |
122 | |
89 } // namespace | 123 } // namespace |
90 | 124 |
91 namespace internal { | 125 namespace internal { |
92 | 126 |
93 class Call : public webrtc::Call, | 127 class Call : public webrtc::Call, |
94 public PacketReceiver, | 128 public PacketReceiver, |
95 public RecoveredPacketReceiver, | 129 public RecoveredPacketReceiver, |
96 public CongestionController::Observer, | 130 public CongestionController::Observer, |
97 public BitrateAllocator::LimitObserver { | 131 public BitrateAllocator::LimitObserver { |
98 public: | 132 public: |
99 explicit Call(const Call::Config& config); | 133 Call(const Call::Config& config, |
134 std::unique_ptr<RtpTransportController> transport); | |
100 virtual ~Call(); | 135 virtual ~Call(); |
101 | 136 |
102 // Implements webrtc::Call. | 137 // Implements webrtc::Call. |
103 PacketReceiver* Receiver() override; | 138 PacketReceiver* Receiver() override; |
104 | 139 |
105 webrtc::AudioSendStream* CreateAudioSendStream( | 140 webrtc::AudioSendStream* CreateAudioSendStream( |
106 const webrtc::AudioSendStream::Config& config) override; | 141 const webrtc::AudioSendStream::Config& config) override; |
107 void DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) override; | 142 void DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) override; |
108 | 143 |
109 webrtc::AudioReceiveStream* CreateAudioReceiveStream( | 144 webrtc::AudioReceiveStream* CreateAudioReceiveStream( |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 // TODO(holmer): Remove this lock once BitrateController no longer calls | 298 // TODO(holmer): Remove this lock once BitrateController no longer calls |
264 // OnNetworkChanged from multiple threads. | 299 // OnNetworkChanged from multiple threads. |
265 rtc::CriticalSection bitrate_crit_; | 300 rtc::CriticalSection bitrate_crit_; |
266 uint32_t min_allocated_send_bitrate_bps_ GUARDED_BY(&bitrate_crit_); | 301 uint32_t min_allocated_send_bitrate_bps_ GUARDED_BY(&bitrate_crit_); |
267 uint32_t configured_max_padding_bitrate_bps_ GUARDED_BY(&bitrate_crit_); | 302 uint32_t configured_max_padding_bitrate_bps_ GUARDED_BY(&bitrate_crit_); |
268 AvgCounter estimated_send_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_); | 303 AvgCounter estimated_send_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_); |
269 AvgCounter pacer_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_); | 304 AvgCounter pacer_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_); |
270 | 305 |
271 std::map<std::string, rtc::NetworkRoute> network_routes_; | 306 std::map<std::string, rtc::NetworkRoute> network_routes_; |
272 | 307 |
273 VieRemb remb_; | 308 std::unique_ptr<RtpTransportController> transport_; |
274 PacketRouter packet_router_; | |
275 // TODO(nisse): Could be a direct member, except for constness | |
276 // issues with GetRemoteBitrateEstimator (and maybe others). | |
277 const std::unique_ptr<CongestionController> congestion_controller_; | |
278 const std::unique_ptr<SendDelayStats> video_send_delay_stats_; | 309 const std::unique_ptr<SendDelayStats> video_send_delay_stats_; |
279 const int64_t start_ms_; | 310 const int64_t start_ms_; |
280 // TODO(perkj): |worker_queue_| is supposed to replace | 311 // TODO(perkj): |worker_queue_| is supposed to replace |
281 // |module_process_thread_|. | 312 // |module_process_thread_|. |
282 // |worker_queue| is defined last to ensure all pending tasks are cancelled | 313 // |worker_queue| is defined last to ensure all pending tasks are cancelled |
283 // and deleted before any other members. | 314 // and deleted before any other members. |
284 rtc::TaskQueue worker_queue_; | 315 rtc::TaskQueue worker_queue_; |
285 | 316 |
286 RTC_DISALLOW_COPY_AND_ASSIGN(Call); | 317 RTC_DISALLOW_COPY_AND_ASSIGN(Call); |
287 }; | 318 }; |
288 } // namespace internal | 319 } // namespace internal |
289 | 320 |
290 std::string Call::Stats::ToString(int64_t time_ms) const { | 321 std::string Call::Stats::ToString(int64_t time_ms) const { |
291 std::stringstream ss; | 322 std::stringstream ss; |
292 ss << "Call stats: " << time_ms << ", {"; | 323 ss << "Call stats: " << time_ms << ", {"; |
293 ss << "send_bw_bps: " << send_bandwidth_bps << ", "; | 324 ss << "send_bw_bps: " << send_bandwidth_bps << ", "; |
294 ss << "recv_bw_bps: " << recv_bandwidth_bps << ", "; | 325 ss << "recv_bw_bps: " << recv_bandwidth_bps << ", "; |
295 ss << "max_pad_bps: " << max_padding_bitrate_bps << ", "; | 326 ss << "max_pad_bps: " << max_padding_bitrate_bps << ", "; |
296 ss << "pacer_delay_ms: " << pacer_delay_ms << ", "; | 327 ss << "pacer_delay_ms: " << pacer_delay_ms << ", "; |
297 ss << "rtt_ms: " << rtt_ms; | 328 ss << "rtt_ms: " << rtt_ms; |
298 ss << '}'; | 329 ss << '}'; |
299 return ss.str(); | 330 return ss.str(); |
300 } | 331 } |
301 | 332 |
302 Call* Call::Create(const Call::Config& config) { | 333 Call* Call::Create(const Call::Config& config) { |
303 return new internal::Call(config); | 334 return new internal::Call( |
335 config, | |
336 std::unique_ptr<RtpTransportController>(new RtpTransportController( | |
337 Clock::GetRealTimeClock(), config.event_log))); | |
304 } | 338 } |
305 | 339 |
306 namespace internal { | 340 namespace internal { |
307 | 341 |
308 Call::Call(const Call::Config& config) | 342 Call::Call(const Call::Config& config, |
343 std::unique_ptr<RtpTransportController> transport) | |
309 : clock_(Clock::GetRealTimeClock()), | 344 : clock_(Clock::GetRealTimeClock()), |
310 num_cpu_cores_(CpuInfo::DetectNumberOfCores()), | 345 num_cpu_cores_(CpuInfo::DetectNumberOfCores()), |
311 module_process_thread_(ProcessThread::Create("ModuleProcessThread")), | 346 module_process_thread_(ProcessThread::Create("ModuleProcessThread")), |
312 pacer_thread_(ProcessThread::Create("PacerThread")), | 347 pacer_thread_(ProcessThread::Create("PacerThread")), |
313 call_stats_(new CallStats(clock_)), | 348 call_stats_(new CallStats(clock_)), |
314 bitrate_allocator_(new BitrateAllocator(this)), | 349 bitrate_allocator_(new BitrateAllocator(this)), |
315 config_(config), | 350 config_(config), |
316 audio_network_state_(kNetworkDown), | 351 audio_network_state_(kNetworkDown), |
317 video_network_state_(kNetworkDown), | 352 video_network_state_(kNetworkDown), |
318 receive_crit_(RWLockWrapper::CreateRWLock()), | 353 receive_crit_(RWLockWrapper::CreateRWLock()), |
319 send_crit_(RWLockWrapper::CreateRWLock()), | 354 send_crit_(RWLockWrapper::CreateRWLock()), |
320 event_log_(config.event_log), | 355 event_log_(config.event_log), |
321 first_packet_sent_ms_(-1), | 356 first_packet_sent_ms_(-1), |
322 received_bytes_per_second_counter_(clock_, nullptr, true), | 357 received_bytes_per_second_counter_(clock_, nullptr, true), |
323 received_audio_bytes_per_second_counter_(clock_, nullptr, true), | 358 received_audio_bytes_per_second_counter_(clock_, nullptr, true), |
324 received_video_bytes_per_second_counter_(clock_, nullptr, true), | 359 received_video_bytes_per_second_counter_(clock_, nullptr, true), |
325 received_rtcp_bytes_per_second_counter_(clock_, nullptr, true), | 360 received_rtcp_bytes_per_second_counter_(clock_, nullptr, true), |
326 min_allocated_send_bitrate_bps_(0), | 361 min_allocated_send_bitrate_bps_(0), |
327 configured_max_padding_bitrate_bps_(0), | 362 configured_max_padding_bitrate_bps_(0), |
328 estimated_send_bitrate_kbps_counter_(clock_, nullptr, true), | 363 estimated_send_bitrate_kbps_counter_(clock_, nullptr, true), |
329 pacer_bitrate_kbps_counter_(clock_, nullptr, true), | 364 pacer_bitrate_kbps_counter_(clock_, nullptr, true), |
330 remb_(clock_), | 365 transport_(std::move(transport)), |
331 congestion_controller_(new CongestionController(clock_, | |
332 this, | |
333 &remb_, | |
334 event_log_, | |
335 &packet_router_)), | |
336 video_send_delay_stats_(new SendDelayStats(clock_)), | 366 video_send_delay_stats_(new SendDelayStats(clock_)), |
337 start_ms_(clock_->TimeInMilliseconds()), | 367 start_ms_(clock_->TimeInMilliseconds()), |
338 worker_queue_("call_worker_queue") { | 368 worker_queue_("call_worker_queue") { |
339 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 369 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
340 RTC_DCHECK(config.event_log != nullptr); | 370 RTC_DCHECK(config.event_log != nullptr); |
341 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); | 371 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); |
342 RTC_DCHECK_GT(config.bitrate_config.start_bitrate_bps, | 372 RTC_DCHECK_GT(config.bitrate_config.start_bitrate_bps, |
343 config.bitrate_config.min_bitrate_bps); | 373 config.bitrate_config.min_bitrate_bps); |
344 if (config.bitrate_config.max_bitrate_bps != -1) { | 374 if (config.bitrate_config.max_bitrate_bps != -1) { |
345 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, | 375 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, |
346 config.bitrate_config.start_bitrate_bps); | 376 config.bitrate_config.start_bitrate_bps); |
347 } | 377 } |
348 Trace::CreateTrace(); | 378 Trace::CreateTrace(); |
349 call_stats_->RegisterStatsObserver(congestion_controller_.get()); | 379 transport_->InitCongestionControl(this); |
350 | 380 transport_->congestion_controller()->SignalNetworkState(kNetworkDown); |
351 congestion_controller_->SignalNetworkState(kNetworkDown); | 381 transport_->congestion_controller()->SetBweBitrates( |
352 congestion_controller_->SetBweBitrates( | |
353 config_.bitrate_config.min_bitrate_bps, | 382 config_.bitrate_config.min_bitrate_bps, |
354 config_.bitrate_config.start_bitrate_bps, | 383 config_.bitrate_config.start_bitrate_bps, |
355 config_.bitrate_config.max_bitrate_bps); | 384 config_.bitrate_config.max_bitrate_bps); |
385 call_stats_->RegisterStatsObserver(transport_->congestion_controller()); | |
356 | 386 |
357 module_process_thread_->Start(); | 387 module_process_thread_->Start(); |
358 module_process_thread_->RegisterModule(call_stats_.get()); | 388 module_process_thread_->RegisterModule(call_stats_.get()); |
359 module_process_thread_->RegisterModule(congestion_controller_.get()); | 389 module_process_thread_->RegisterModule(transport_->congestion_controller()); |
360 pacer_thread_->RegisterModule(congestion_controller_->pacer()); | 390 pacer_thread_->RegisterModule(transport_->congestion_controller()->pacer()); |
361 pacer_thread_->RegisterModule( | 391 pacer_thread_->RegisterModule( |
362 congestion_controller_->GetRemoteBitrateEstimator(true)); | 392 transport_->congestion_controller()->GetRemoteBitrateEstimator(true)); |
363 pacer_thread_->Start(); | 393 pacer_thread_->Start(); |
364 } | 394 } |
365 | 395 |
366 Call::~Call() { | 396 Call::~Call() { |
367 RTC_DCHECK(!remb_.InUse()); | 397 RTC_DCHECK(!transport_->remb()->InUse()); |
368 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 398 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
369 | 399 |
370 RTC_CHECK(audio_send_ssrcs_.empty()); | 400 RTC_CHECK(audio_send_ssrcs_.empty()); |
371 RTC_CHECK(video_send_ssrcs_.empty()); | 401 RTC_CHECK(video_send_ssrcs_.empty()); |
372 RTC_CHECK(video_send_streams_.empty()); | 402 RTC_CHECK(video_send_streams_.empty()); |
373 RTC_CHECK(audio_receive_ssrcs_.empty()); | 403 RTC_CHECK(audio_receive_ssrcs_.empty()); |
374 RTC_CHECK(video_receive_ssrcs_.empty()); | 404 RTC_CHECK(video_receive_ssrcs_.empty()); |
375 RTC_CHECK(video_receive_streams_.empty()); | 405 RTC_CHECK(video_receive_streams_.empty()); |
376 | 406 |
377 pacer_thread_->Stop(); | 407 pacer_thread_->Stop(); |
378 pacer_thread_->DeRegisterModule(congestion_controller_->pacer()); | 408 pacer_thread_->DeRegisterModule(transport_->congestion_controller()->pacer()); |
379 pacer_thread_->DeRegisterModule( | 409 pacer_thread_->DeRegisterModule( |
380 congestion_controller_->GetRemoteBitrateEstimator(true)); | 410 transport_->congestion_controller()->GetRemoteBitrateEstimator(true)); |
381 module_process_thread_->DeRegisterModule(congestion_controller_.get()); | 411 module_process_thread_->DeRegisterModule(transport_->congestion_controller()); |
382 module_process_thread_->DeRegisterModule(call_stats_.get()); | 412 module_process_thread_->DeRegisterModule(call_stats_.get()); |
383 module_process_thread_->Stop(); | 413 module_process_thread_->Stop(); |
384 call_stats_->DeregisterStatsObserver(congestion_controller_.get()); | 414 call_stats_->DeregisterStatsObserver(transport_->congestion_controller()); |
385 | 415 |
386 // Only update histograms after process threads have been shut down, so that | 416 // Only update histograms after process threads have been shut down, so that |
387 // they won't try to concurrently update stats. | 417 // they won't try to concurrently update stats. |
388 { | 418 { |
389 rtc::CritScope lock(&bitrate_crit_); | 419 rtc::CritScope lock(&bitrate_crit_); |
390 UpdateSendHistograms(); | 420 UpdateSendHistograms(); |
391 } | 421 } |
392 UpdateReceiveHistograms(); | 422 UpdateReceiveHistograms(); |
393 UpdateHistograms(); | 423 UpdateHistograms(); |
394 | 424 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
492 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 522 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
493 return this; | 523 return this; |
494 } | 524 } |
495 | 525 |
496 webrtc::AudioSendStream* Call::CreateAudioSendStream( | 526 webrtc::AudioSendStream* Call::CreateAudioSendStream( |
497 const webrtc::AudioSendStream::Config& config) { | 527 const webrtc::AudioSendStream::Config& config) { |
498 TRACE_EVENT0("webrtc", "Call::CreateAudioSendStream"); | 528 TRACE_EVENT0("webrtc", "Call::CreateAudioSendStream"); |
499 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 529 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
500 event_log_->LogAudioSendStreamConfig(config); | 530 event_log_->LogAudioSendStreamConfig(config); |
501 AudioSendStream* send_stream = new AudioSendStream( | 531 AudioSendStream* send_stream = new AudioSendStream( |
502 config, config_.audio_state, &worker_queue_, &packet_router_, | 532 config, config_.audio_state, &worker_queue_, transport_.get(), |
503 congestion_controller_.get(), bitrate_allocator_.get(), event_log_, | 533 bitrate_allocator_.get(), event_log_, call_stats_->rtcp_rtt_stats()); |
504 call_stats_->rtcp_rtt_stats()); | |
505 { | 534 { |
506 WriteLockScoped write_lock(*send_crit_); | 535 WriteLockScoped write_lock(*send_crit_); |
507 RTC_DCHECK(audio_send_ssrcs_.find(config.rtp.ssrc) == | 536 RTC_DCHECK(audio_send_ssrcs_.find(config.rtp.ssrc) == |
508 audio_send_ssrcs_.end()); | 537 audio_send_ssrcs_.end()); |
509 audio_send_ssrcs_[config.rtp.ssrc] = send_stream; | 538 audio_send_ssrcs_[config.rtp.ssrc] = send_stream; |
510 } | 539 } |
511 { | 540 { |
512 ReadLockScoped read_lock(*receive_crit_); | 541 ReadLockScoped read_lock(*receive_crit_); |
513 for (const auto& kv : audio_receive_ssrcs_) { | 542 for (const auto& kv : audio_receive_ssrcs_) { |
514 if (kv.second->config().rtp.local_ssrc == config.rtp.ssrc) { | 543 if (kv.second->config().rtp.local_ssrc == config.rtp.ssrc) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
547 UpdateAggregateNetworkState(); | 576 UpdateAggregateNetworkState(); |
548 delete audio_send_stream; | 577 delete audio_send_stream; |
549 } | 578 } |
550 | 579 |
551 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( | 580 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( |
552 const webrtc::AudioReceiveStream::Config& config) { | 581 const webrtc::AudioReceiveStream::Config& config) { |
553 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); | 582 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); |
554 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 583 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
555 event_log_->LogAudioReceiveStreamConfig(config); | 584 event_log_->LogAudioReceiveStreamConfig(config); |
556 AudioReceiveStream* receive_stream = new AudioReceiveStream( | 585 AudioReceiveStream* receive_stream = new AudioReceiveStream( |
557 &packet_router_, config, | 586 transport_->packet_router(), config, config_.audio_state, event_log_); |
558 config_.audio_state, event_log_); | |
559 { | 587 { |
560 WriteLockScoped write_lock(*receive_crit_); | 588 WriteLockScoped write_lock(*receive_crit_); |
561 RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) == | 589 RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) == |
562 audio_receive_ssrcs_.end()); | 590 audio_receive_ssrcs_.end()); |
563 audio_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; | 591 audio_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; |
564 receive_rtp_config_[config.rtp.remote_ssrc] = | 592 receive_rtp_config_[config.rtp.remote_ssrc] = |
565 ReceiveRtpConfig(config.rtp.extensions, UseSendSideBwe(config)); | 593 ReceiveRtpConfig(config.rtp.extensions, UseSendSideBwe(config)); |
566 | 594 |
567 ConfigureSync(config.sync_group); | 595 ConfigureSync(config.sync_group); |
568 } | 596 } |
(...skipping 13 matching lines...) Expand all Loading... | |
582 webrtc::AudioReceiveStream* receive_stream) { | 610 webrtc::AudioReceiveStream* receive_stream) { |
583 TRACE_EVENT0("webrtc", "Call::DestroyAudioReceiveStream"); | 611 TRACE_EVENT0("webrtc", "Call::DestroyAudioReceiveStream"); |
584 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 612 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
585 RTC_DCHECK(receive_stream != nullptr); | 613 RTC_DCHECK(receive_stream != nullptr); |
586 webrtc::internal::AudioReceiveStream* audio_receive_stream = | 614 webrtc::internal::AudioReceiveStream* audio_receive_stream = |
587 static_cast<webrtc::internal::AudioReceiveStream*>(receive_stream); | 615 static_cast<webrtc::internal::AudioReceiveStream*>(receive_stream); |
588 { | 616 { |
589 WriteLockScoped write_lock(*receive_crit_); | 617 WriteLockScoped write_lock(*receive_crit_); |
590 const AudioReceiveStream::Config& config = audio_receive_stream->config(); | 618 const AudioReceiveStream::Config& config = audio_receive_stream->config(); |
591 uint32_t ssrc = config.rtp.remote_ssrc; | 619 uint32_t ssrc = config.rtp.remote_ssrc; |
592 congestion_controller_->GetRemoteBitrateEstimator(UseSendSideBwe(config)) | 620 transport_->congestion_controller() |
621 ->GetRemoteBitrateEstimator(UseSendSideBwe(config)) | |
593 ->RemoveStream(ssrc); | 622 ->RemoveStream(ssrc); |
594 size_t num_deleted = audio_receive_ssrcs_.erase(ssrc); | 623 size_t num_deleted = audio_receive_ssrcs_.erase(ssrc); |
595 RTC_DCHECK(num_deleted == 1); | 624 RTC_DCHECK(num_deleted == 1); |
596 const std::string& sync_group = audio_receive_stream->config().sync_group; | 625 const std::string& sync_group = audio_receive_stream->config().sync_group; |
597 const auto it = sync_stream_mapping_.find(sync_group); | 626 const auto it = sync_stream_mapping_.find(sync_group); |
598 if (it != sync_stream_mapping_.end() && | 627 if (it != sync_stream_mapping_.end() && |
599 it->second == audio_receive_stream) { | 628 it->second == audio_receive_stream) { |
600 sync_stream_mapping_.erase(it); | 629 sync_stream_mapping_.erase(it); |
601 ConfigureSync(sync_group); | 630 ConfigureSync(sync_group); |
602 } | 631 } |
(...skipping 11 matching lines...) Expand all Loading... | |
614 | 643 |
615 video_send_delay_stats_->AddSsrcs(config); | 644 video_send_delay_stats_->AddSsrcs(config); |
616 event_log_->LogVideoSendStreamConfig(config); | 645 event_log_->LogVideoSendStreamConfig(config); |
617 | 646 |
618 // TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if | 647 // TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if |
619 // the call has already started. | 648 // the call has already started. |
620 // Copy ssrcs from |config| since |config| is moved. | 649 // Copy ssrcs from |config| since |config| is moved. |
621 std::vector<uint32_t> ssrcs = config.rtp.ssrcs; | 650 std::vector<uint32_t> ssrcs = config.rtp.ssrcs; |
622 VideoSendStream* send_stream = new VideoSendStream( | 651 VideoSendStream* send_stream = new VideoSendStream( |
623 num_cpu_cores_, module_process_thread_.get(), &worker_queue_, | 652 num_cpu_cores_, module_process_thread_.get(), &worker_queue_, |
624 call_stats_.get(), congestion_controller_.get(), &packet_router_, | 653 call_stats_.get(), transport_.get(), bitrate_allocator_.get(), |
625 bitrate_allocator_.get(), video_send_delay_stats_.get(), &remb_, | 654 video_send_delay_stats_.get(), event_log_, std::move(config), |
626 event_log_, std::move(config), std::move(encoder_config), | 655 std::move(encoder_config), suspended_video_send_ssrcs_); |
627 suspended_video_send_ssrcs_); | |
628 | 656 |
629 { | 657 { |
630 WriteLockScoped write_lock(*send_crit_); | 658 WriteLockScoped write_lock(*send_crit_); |
631 for (uint32_t ssrc : ssrcs) { | 659 for (uint32_t ssrc : ssrcs) { |
632 RTC_DCHECK(video_send_ssrcs_.find(ssrc) == video_send_ssrcs_.end()); | 660 RTC_DCHECK(video_send_ssrcs_.find(ssrc) == video_send_ssrcs_.end()); |
633 video_send_ssrcs_[ssrc] = send_stream; | 661 video_send_ssrcs_[ssrc] = send_stream; |
634 } | 662 } |
635 video_send_streams_.insert(send_stream); | 663 video_send_streams_.insert(send_stream); |
636 } | 664 } |
637 send_stream->SignalNetworkState(video_network_state_); | 665 send_stream->SignalNetworkState(video_network_state_); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
681 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 709 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
682 | 710 |
683 bool protected_by_flexfec = false; | 711 bool protected_by_flexfec = false; |
684 { | 712 { |
685 ReadLockScoped read_lock(*receive_crit_); | 713 ReadLockScoped read_lock(*receive_crit_); |
686 protected_by_flexfec = | 714 protected_by_flexfec = |
687 flexfec_receive_ssrcs_media_.find(configuration.rtp.remote_ssrc) != | 715 flexfec_receive_ssrcs_media_.find(configuration.rtp.remote_ssrc) != |
688 flexfec_receive_ssrcs_media_.end(); | 716 flexfec_receive_ssrcs_media_.end(); |
689 } | 717 } |
690 VideoReceiveStream* receive_stream = new VideoReceiveStream( | 718 VideoReceiveStream* receive_stream = new VideoReceiveStream( |
691 num_cpu_cores_, protected_by_flexfec, | 719 num_cpu_cores_, protected_by_flexfec, transport_->packet_router(), |
692 &packet_router_, std::move(configuration), module_process_thread_.get(), | 720 std::move(configuration), module_process_thread_.get(), call_stats_.get(), |
693 call_stats_.get(), &remb_); | 721 transport_->remb()); |
694 | 722 |
695 const webrtc::VideoReceiveStream::Config& config = receive_stream->config(); | 723 const webrtc::VideoReceiveStream::Config& config = receive_stream->config(); |
696 ReceiveRtpConfig receive_config(config.rtp.extensions, | 724 ReceiveRtpConfig receive_config(config.rtp.extensions, |
697 UseSendSideBwe(config)); | 725 UseSendSideBwe(config)); |
698 { | 726 { |
699 WriteLockScoped write_lock(*receive_crit_); | 727 WriteLockScoped write_lock(*receive_crit_); |
700 RTC_DCHECK(video_receive_ssrcs_.find(config.rtp.remote_ssrc) == | 728 RTC_DCHECK(video_receive_ssrcs_.find(config.rtp.remote_ssrc) == |
701 video_receive_ssrcs_.end()); | 729 video_receive_ssrcs_.end()); |
702 video_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; | 730 video_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; |
703 if (config.rtp.rtx_ssrc) { | 731 if (config.rtp.rtx_ssrc) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
739 } else { | 767 } else { |
740 ++it; | 768 ++it; |
741 } | 769 } |
742 } | 770 } |
743 video_receive_streams_.erase(receive_stream_impl); | 771 video_receive_streams_.erase(receive_stream_impl); |
744 RTC_CHECK(receive_stream_impl != nullptr); | 772 RTC_CHECK(receive_stream_impl != nullptr); |
745 ConfigureSync(receive_stream_impl->config().sync_group); | 773 ConfigureSync(receive_stream_impl->config().sync_group); |
746 } | 774 } |
747 const VideoReceiveStream::Config& config = receive_stream_impl->config(); | 775 const VideoReceiveStream::Config& config = receive_stream_impl->config(); |
748 | 776 |
749 congestion_controller_->GetRemoteBitrateEstimator(UseSendSideBwe(config)) | 777 transport_->congestion_controller() |
778 ->GetRemoteBitrateEstimator(UseSendSideBwe(config)) | |
stefan-webrtc
2017/02/17 11:59:28
What would it take to get rid of GetRemoteBitrateE
nisse-webrtc
2017/02/17 12:35:14
I agree this could use some cleanup, but that's fo
| |
750 ->RemoveStream(config.rtp.remote_ssrc); | 779 ->RemoveStream(config.rtp.remote_ssrc); |
751 | 780 |
752 UpdateAggregateNetworkState(); | 781 UpdateAggregateNetworkState(); |
753 delete receive_stream_impl; | 782 delete receive_stream_impl; |
754 } | 783 } |
755 | 784 |
756 FlexfecReceiveStream* Call::CreateFlexfecReceiveStream( | 785 FlexfecReceiveStream* Call::CreateFlexfecReceiveStream( |
757 const FlexfecReceiveStream::Config& config) { | 786 const FlexfecReceiveStream::Config& config) { |
758 TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream"); | 787 TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream"); |
759 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 788 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
815 ++prot_it; | 844 ++prot_it; |
816 } | 845 } |
817 auto media_it = flexfec_receive_ssrcs_media_.begin(); | 846 auto media_it = flexfec_receive_ssrcs_media_.begin(); |
818 while (media_it != flexfec_receive_ssrcs_media_.end()) { | 847 while (media_it != flexfec_receive_ssrcs_media_.end()) { |
819 if (media_it->second == receive_stream_impl) | 848 if (media_it->second == receive_stream_impl) |
820 media_it = flexfec_receive_ssrcs_media_.erase(media_it); | 849 media_it = flexfec_receive_ssrcs_media_.erase(media_it); |
821 else | 850 else |
822 ++media_it; | 851 ++media_it; |
823 } | 852 } |
824 | 853 |
825 congestion_controller_->GetRemoteBitrateEstimator(UseSendSideBwe(config)) | 854 transport_->congestion_controller() |
855 ->GetRemoteBitrateEstimator(UseSendSideBwe(config)) | |
826 ->RemoveStream(ssrc); | 856 ->RemoveStream(ssrc); |
827 | 857 |
828 flexfec_receive_streams_.erase(receive_stream_impl); | 858 flexfec_receive_streams_.erase(receive_stream_impl); |
829 } | 859 } |
830 | 860 |
831 delete receive_stream_impl; | 861 delete receive_stream_impl; |
832 } | 862 } |
833 | 863 |
834 Call::Stats Call::GetStats() const { | 864 Call::Stats Call::GetStats() const { |
835 // TODO(solenberg): Some test cases in EndToEndTest use this from a different | 865 // TODO(solenberg): Some test cases in EndToEndTest use this from a different |
836 // thread. Re-enable once that is fixed. | 866 // thread. Re-enable once that is fixed. |
837 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 867 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
838 Stats stats; | 868 Stats stats; |
839 // Fetch available send/receive bitrates. | 869 // Fetch available send/receive bitrates. |
840 uint32_t send_bandwidth = 0; | 870 uint32_t send_bandwidth = 0; |
841 congestion_controller_->GetBitrateController()->AvailableBandwidth( | 871 transport_->congestion_controller() |
842 &send_bandwidth); | 872 ->GetBitrateController() |
873 ->AvailableBandwidth(&send_bandwidth); | |
843 std::vector<unsigned int> ssrcs; | 874 std::vector<unsigned int> ssrcs; |
844 uint32_t recv_bandwidth = 0; | 875 uint32_t recv_bandwidth = 0; |
845 congestion_controller_->GetRemoteBitrateEstimator(false)->LatestEstimate( | 876 transport_->congestion_controller() |
846 &ssrcs, &recv_bandwidth); | 877 ->GetRemoteBitrateEstimator(false) |
878 ->LatestEstimate(&ssrcs, &recv_bandwidth); | |
847 stats.send_bandwidth_bps = send_bandwidth; | 879 stats.send_bandwidth_bps = send_bandwidth; |
848 stats.recv_bandwidth_bps = recv_bandwidth; | 880 stats.recv_bandwidth_bps = recv_bandwidth; |
849 stats.pacer_delay_ms = congestion_controller_->GetPacerQueuingDelayMs(); | 881 stats.pacer_delay_ms = |
882 transport_->congestion_controller()->GetPacerQueuingDelayMs(); | |
850 stats.rtt_ms = call_stats_->rtcp_rtt_stats()->LastProcessedRtt(); | 883 stats.rtt_ms = call_stats_->rtcp_rtt_stats()->LastProcessedRtt(); |
851 { | 884 { |
852 rtc::CritScope cs(&bitrate_crit_); | 885 rtc::CritScope cs(&bitrate_crit_); |
853 stats.max_padding_bitrate_bps = configured_max_padding_bitrate_bps_; | 886 stats.max_padding_bitrate_bps = configured_max_padding_bitrate_bps_; |
854 } | 887 } |
855 return stats; | 888 return stats; |
856 } | 889 } |
857 | 890 |
858 void Call::SetBitrateConfig( | 891 void Call::SetBitrateConfig( |
859 const webrtc::Call::Config::BitrateConfig& bitrate_config) { | 892 const webrtc::Call::Config::BitrateConfig& bitrate_config) { |
(...skipping 12 matching lines...) Expand all Loading... | |
872 // Nothing new to set, early abort to avoid encoder reconfigurations. | 905 // Nothing new to set, early abort to avoid encoder reconfigurations. |
873 return; | 906 return; |
874 } | 907 } |
875 config_.bitrate_config.min_bitrate_bps = bitrate_config.min_bitrate_bps; | 908 config_.bitrate_config.min_bitrate_bps = bitrate_config.min_bitrate_bps; |
876 // Start bitrate of -1 means we should keep the old bitrate, which there is | 909 // Start bitrate of -1 means we should keep the old bitrate, which there is |
877 // no point in remembering for the future. | 910 // no point in remembering for the future. |
878 if (bitrate_config.start_bitrate_bps > 0) | 911 if (bitrate_config.start_bitrate_bps > 0) |
879 config_.bitrate_config.start_bitrate_bps = bitrate_config.start_bitrate_bps; | 912 config_.bitrate_config.start_bitrate_bps = bitrate_config.start_bitrate_bps; |
880 config_.bitrate_config.max_bitrate_bps = bitrate_config.max_bitrate_bps; | 913 config_.bitrate_config.max_bitrate_bps = bitrate_config.max_bitrate_bps; |
881 RTC_DCHECK_NE(bitrate_config.start_bitrate_bps, 0); | 914 RTC_DCHECK_NE(bitrate_config.start_bitrate_bps, 0); |
882 congestion_controller_->SetBweBitrates(bitrate_config.min_bitrate_bps, | 915 transport_->congestion_controller()->SetBweBitrates( |
883 bitrate_config.start_bitrate_bps, | 916 bitrate_config.min_bitrate_bps, bitrate_config.start_bitrate_bps, |
884 bitrate_config.max_bitrate_bps); | 917 bitrate_config.max_bitrate_bps); |
885 } | 918 } |
886 | 919 |
887 void Call::SignalChannelNetworkState(MediaType media, NetworkState state) { | 920 void Call::SignalChannelNetworkState(MediaType media, NetworkState state) { |
888 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 921 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
889 switch (media) { | 922 switch (media) { |
890 case MediaType::AUDIO: | 923 case MediaType::AUDIO: |
891 audio_network_state_ = state; | 924 audio_network_state_ = state; |
892 break; | 925 break; |
893 case MediaType::VIDEO: | 926 case MediaType::VIDEO: |
894 video_network_state_ = state; | 927 video_network_state_ = state; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
969 kv->second = network_route; | 1002 kv->second = network_route; |
970 LOG(LS_INFO) << "Network route changed on transport " << transport_name | 1003 LOG(LS_INFO) << "Network route changed on transport " << transport_name |
971 << ": new local network id " << network_route.local_network_id | 1004 << ": new local network id " << network_route.local_network_id |
972 << " new remote network id " << network_route.remote_network_id | 1005 << " new remote network id " << network_route.remote_network_id |
973 << " Reset bitrates to min: " | 1006 << " Reset bitrates to min: " |
974 << config_.bitrate_config.min_bitrate_bps | 1007 << config_.bitrate_config.min_bitrate_bps |
975 << " bps, start: " << config_.bitrate_config.start_bitrate_bps | 1008 << " bps, start: " << config_.bitrate_config.start_bitrate_bps |
976 << " bps, max: " << config_.bitrate_config.start_bitrate_bps | 1009 << " bps, max: " << config_.bitrate_config.start_bitrate_bps |
977 << " bps."; | 1010 << " bps."; |
978 RTC_DCHECK_GT(config_.bitrate_config.start_bitrate_bps, 0); | 1011 RTC_DCHECK_GT(config_.bitrate_config.start_bitrate_bps, 0); |
979 congestion_controller_->ResetBweAndBitrates( | 1012 transport_->congestion_controller()->ResetBweAndBitrates( |
980 config_.bitrate_config.start_bitrate_bps, | 1013 config_.bitrate_config.start_bitrate_bps, |
981 config_.bitrate_config.min_bitrate_bps, | 1014 config_.bitrate_config.min_bitrate_bps, |
982 config_.bitrate_config.max_bitrate_bps); | 1015 config_.bitrate_config.max_bitrate_bps); |
983 } | 1016 } |
984 } | 1017 } |
985 | 1018 |
986 void Call::UpdateAggregateNetworkState() { | 1019 void Call::UpdateAggregateNetworkState() { |
987 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 1020 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
988 | 1021 |
989 bool have_audio = false; | 1022 bool have_audio = false; |
(...skipping 15 matching lines...) Expand all Loading... | |
1005 | 1038 |
1006 NetworkState aggregate_state = kNetworkDown; | 1039 NetworkState aggregate_state = kNetworkDown; |
1007 if ((have_video && video_network_state_ == kNetworkUp) || | 1040 if ((have_video && video_network_state_ == kNetworkUp) || |
1008 (have_audio && audio_network_state_ == kNetworkUp)) { | 1041 (have_audio && audio_network_state_ == kNetworkUp)) { |
1009 aggregate_state = kNetworkUp; | 1042 aggregate_state = kNetworkUp; |
1010 } | 1043 } |
1011 | 1044 |
1012 LOG(LS_INFO) << "UpdateAggregateNetworkState: aggregate_state=" | 1045 LOG(LS_INFO) << "UpdateAggregateNetworkState: aggregate_state=" |
1013 << (aggregate_state == kNetworkUp ? "up" : "down"); | 1046 << (aggregate_state == kNetworkUp ? "up" : "down"); |
1014 | 1047 |
1015 congestion_controller_->SignalNetworkState(aggregate_state); | 1048 transport_->congestion_controller()->SignalNetworkState(aggregate_state); |
1016 } | 1049 } |
1017 | 1050 |
1018 void Call::OnSentPacket(const rtc::SentPacket& sent_packet) { | 1051 void Call::OnSentPacket(const rtc::SentPacket& sent_packet) { |
1019 if (first_packet_sent_ms_ == -1) | 1052 if (first_packet_sent_ms_ == -1) |
1020 first_packet_sent_ms_ = clock_->TimeInMilliseconds(); | 1053 first_packet_sent_ms_ = clock_->TimeInMilliseconds(); |
1021 video_send_delay_stats_->OnSentPacket(sent_packet.packet_id, | 1054 video_send_delay_stats_->OnSentPacket(sent_packet.packet_id, |
1022 clock_->TimeInMilliseconds()); | 1055 clock_->TimeInMilliseconds()); |
1023 congestion_controller_->OnSentPacket(sent_packet); | 1056 transport_->congestion_controller()->OnSentPacket(sent_packet); |
1024 } | 1057 } |
1025 | 1058 |
1026 void Call::OnNetworkChanged(uint32_t target_bitrate_bps, | 1059 void Call::OnNetworkChanged(uint32_t target_bitrate_bps, |
1027 uint8_t fraction_loss, | 1060 uint8_t fraction_loss, |
1028 int64_t rtt_ms, | 1061 int64_t rtt_ms, |
1029 int64_t probing_interval_ms) { | 1062 int64_t probing_interval_ms) { |
1030 // TODO(perkj): Consider making sure CongestionController operates on | 1063 // TODO(perkj): Consider making sure CongestionController operates on |
1031 // |worker_queue_|. | 1064 // |worker_queue_|. |
1032 if (!worker_queue_.IsCurrent()) { | 1065 if (!worker_queue_.IsCurrent()) { |
1033 worker_queue_.PostTask( | 1066 worker_queue_.PostTask( |
(...skipping 30 matching lines...) Expand all Loading... | |
1064 } | 1097 } |
1065 estimated_send_bitrate_kbps_counter_.Add(target_bitrate_bps / 1000); | 1098 estimated_send_bitrate_kbps_counter_.Add(target_bitrate_bps / 1000); |
1066 // Pacer bitrate may be higher than bitrate estimate if enforcing min bitrate. | 1099 // Pacer bitrate may be higher than bitrate estimate if enforcing min bitrate. |
1067 uint32_t pacer_bitrate_bps = | 1100 uint32_t pacer_bitrate_bps = |
1068 std::max(target_bitrate_bps, min_allocated_send_bitrate_bps_); | 1101 std::max(target_bitrate_bps, min_allocated_send_bitrate_bps_); |
1069 pacer_bitrate_kbps_counter_.Add(pacer_bitrate_bps / 1000); | 1102 pacer_bitrate_kbps_counter_.Add(pacer_bitrate_bps / 1000); |
1070 } | 1103 } |
1071 | 1104 |
1072 void Call::OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps, | 1105 void Call::OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps, |
1073 uint32_t max_padding_bitrate_bps) { | 1106 uint32_t max_padding_bitrate_bps) { |
1074 congestion_controller_->SetAllocatedSendBitrateLimits( | 1107 transport_->congestion_controller()->SetAllocatedSendBitrateLimits( |
1075 min_send_bitrate_bps, max_padding_bitrate_bps); | 1108 min_send_bitrate_bps, max_padding_bitrate_bps); |
1076 rtc::CritScope lock(&bitrate_crit_); | 1109 rtc::CritScope lock(&bitrate_crit_); |
1077 min_allocated_send_bitrate_bps_ = min_send_bitrate_bps; | 1110 min_allocated_send_bitrate_bps_ = min_send_bitrate_bps; |
1078 configured_max_padding_bitrate_bps_ = max_padding_bitrate_bps; | 1111 configured_max_padding_bitrate_bps_ = max_padding_bitrate_bps; |
1079 } | 1112 } |
1080 | 1113 |
1081 void Call::ConfigureSync(const std::string& sync_group) { | 1114 void Call::ConfigureSync(const std::string& sync_group) { |
1082 // Set sync only if there was no previous one. | 1115 // Set sync only if there was no previous one. |
1083 if (sync_group.empty()) | 1116 if (sync_group.empty()) |
1084 return; | 1117 return; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1289 // module in the case that some, but not all, have RTCP feedback | 1322 // module in the case that some, but not all, have RTCP feedback |
1290 // enabled. | 1323 // enabled. |
1291 return; | 1324 return; |
1292 } | 1325 } |
1293 // For audio, we only support send side BWE. | 1326 // For audio, we only support send side BWE. |
1294 // TODO(nisse): Tests passes MediaType::ANY, see | 1327 // TODO(nisse): Tests passes MediaType::ANY, see |
1295 // FakeNetworkPipe::Process. We need to treat that as video. Tests | 1328 // FakeNetworkPipe::Process. We need to treat that as video. Tests |
1296 // should be fixed to use the same MediaType as the production code. | 1329 // should be fixed to use the same MediaType as the production code. |
1297 if (media_type != MediaType::AUDIO || | 1330 if (media_type != MediaType::AUDIO || |
1298 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { | 1331 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { |
1299 congestion_controller_->OnReceivedPacket( | 1332 transport_->congestion_controller()->OnReceivedPacket( |
1300 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), | 1333 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), |
1301 header); | 1334 header); |
1302 } | 1335 } |
1303 } | 1336 } |
1304 | 1337 |
1305 } // namespace internal | 1338 } // namespace internal |
1339 | |
1306 } // namespace webrtc | 1340 } // namespace webrtc |
OLD | NEW |