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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 transport_send->send_side_cc()->RegisterNetworkObserver(this); | 429 transport_send->send_side_cc()->RegisterNetworkObserver(this); |
430 transport_send_ = std::move(transport_send); | 430 transport_send_ = std::move(transport_send); |
431 transport_send_->send_side_cc()->SignalNetworkState(kNetworkDown); | 431 transport_send_->send_side_cc()->SignalNetworkState(kNetworkDown); |
432 transport_send_->send_side_cc()->SetBweBitrates( | 432 transport_send_->send_side_cc()->SetBweBitrates( |
433 config_.bitrate_config.min_bitrate_bps, | 433 config_.bitrate_config.min_bitrate_bps, |
434 config_.bitrate_config.start_bitrate_bps, | 434 config_.bitrate_config.start_bitrate_bps, |
435 config_.bitrate_config.max_bitrate_bps); | 435 config_.bitrate_config.max_bitrate_bps); |
436 call_stats_->RegisterStatsObserver(&receive_side_cc_); | 436 call_stats_->RegisterStatsObserver(&receive_side_cc_); |
437 call_stats_->RegisterStatsObserver(transport_send_->send_side_cc()); | 437 call_stats_->RegisterStatsObserver(transport_send_->send_side_cc()); |
438 | 438 |
439 // We have to attach the pacer to the pacer thread before starting the | 439 module_process_thread_->Start(); |
440 // module process thread to avoid a race accessing the process thread | 440 module_process_thread_->RegisterModule(call_stats_.get(), RTC_FROM_HERE); |
441 // both from the process thread and the pacer thread. | 441 module_process_thread_->RegisterModule(&receive_side_cc_, RTC_FROM_HERE); |
| 442 module_process_thread_->RegisterModule(transport_send_->send_side_cc(), |
| 443 RTC_FROM_HERE); |
442 pacer_thread_->RegisterModule(transport_send_->send_side_cc()->pacer(), | 444 pacer_thread_->RegisterModule(transport_send_->send_side_cc()->pacer(), |
443 RTC_FROM_HERE); | 445 RTC_FROM_HERE); |
444 pacer_thread_->RegisterModule( | 446 pacer_thread_->RegisterModule( |
445 receive_side_cc_.GetRemoteBitrateEstimator(true), RTC_FROM_HERE); | 447 receive_side_cc_.GetRemoteBitrateEstimator(true), RTC_FROM_HERE); |
| 448 |
446 pacer_thread_->Start(); | 449 pacer_thread_->Start(); |
447 | |
448 module_process_thread_->RegisterModule(call_stats_.get(), RTC_FROM_HERE); | |
449 module_process_thread_->RegisterModule(&receive_side_cc_, RTC_FROM_HERE); | |
450 module_process_thread_->RegisterModule(transport_send_->send_side_cc(), | |
451 RTC_FROM_HERE); | |
452 module_process_thread_->Start(); | |
453 } | 450 } |
454 | 451 |
455 Call::~Call() { | 452 Call::~Call() { |
456 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 453 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); |
457 | 454 |
458 RTC_CHECK(audio_send_ssrcs_.empty()); | 455 RTC_CHECK(audio_send_ssrcs_.empty()); |
459 RTC_CHECK(video_send_ssrcs_.empty()); | 456 RTC_CHECK(video_send_ssrcs_.empty()); |
460 RTC_CHECK(video_send_streams_.empty()); | 457 RTC_CHECK(video_send_streams_.empty()); |
461 RTC_CHECK(audio_receive_streams_.empty()); | 458 RTC_CHECK(audio_receive_streams_.empty()); |
462 RTC_CHECK(video_receive_streams_.empty()); | 459 RTC_CHECK(video_receive_streams_.empty()); |
463 | 460 |
464 // The send-side congestion controller must be de-registered prior to | |
465 // the pacer thread being stopped to avoid a race when accessing the | |
466 // pacer thread object on the module process thread at the same time as | |
467 // the pacer thread is stopped. | |
468 module_process_thread_->DeRegisterModule(transport_send_->send_side_cc()); | |
469 pacer_thread_->Stop(); | 461 pacer_thread_->Stop(); |
470 pacer_thread_->DeRegisterModule(transport_send_->send_side_cc()->pacer()); | 462 pacer_thread_->DeRegisterModule(transport_send_->send_side_cc()->pacer()); |
471 pacer_thread_->DeRegisterModule( | 463 pacer_thread_->DeRegisterModule( |
472 receive_side_cc_.GetRemoteBitrateEstimator(true)); | 464 receive_side_cc_.GetRemoteBitrateEstimator(true)); |
| 465 module_process_thread_->DeRegisterModule(transport_send_->send_side_cc()); |
473 module_process_thread_->DeRegisterModule(&receive_side_cc_); | 466 module_process_thread_->DeRegisterModule(&receive_side_cc_); |
474 module_process_thread_->DeRegisterModule(call_stats_.get()); | 467 module_process_thread_->DeRegisterModule(call_stats_.get()); |
475 module_process_thread_->Stop(); | 468 module_process_thread_->Stop(); |
476 call_stats_->DeregisterStatsObserver(&receive_side_cc_); | 469 call_stats_->DeregisterStatsObserver(&receive_side_cc_); |
477 call_stats_->DeregisterStatsObserver(transport_send_->send_side_cc()); | 470 call_stats_->DeregisterStatsObserver(transport_send_->send_side_cc()); |
478 | 471 |
479 int64_t first_sent_packet_ms = | 472 int64_t first_sent_packet_ms = |
480 transport_send_->send_side_cc()->GetFirstPacketTimeMs(); | 473 transport_send_->send_side_cc()->GetFirstPacketTimeMs(); |
481 // Only update histograms after process threads have been shut down, so that | 474 // Only update histograms after process threads have been shut down, so that |
482 // they won't try to concurrently update stats. | 475 // they won't try to concurrently update stats. |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1424 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { | 1417 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { |
1425 receive_side_cc_.OnReceivedPacket( | 1418 receive_side_cc_.OnReceivedPacket( |
1426 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), | 1419 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), |
1427 header); | 1420 header); |
1428 } | 1421 } |
1429 } | 1422 } |
1430 | 1423 |
1431 } // namespace internal | 1424 } // namespace internal |
1432 | 1425 |
1433 } // namespace webrtc | 1426 } // namespace webrtc |
OLD | NEW |