| 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 26 matching lines...) Expand all Loading... |
| 37 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 37 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
| 38 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" | 38 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" |
| 39 #include "webrtc/modules/utility/include/process_thread.h" | 39 #include "webrtc/modules/utility/include/process_thread.h" |
| 40 #include "webrtc/rtc_base/basictypes.h" | 40 #include "webrtc/rtc_base/basictypes.h" |
| 41 #include "webrtc/rtc_base/checks.h" | 41 #include "webrtc/rtc_base/checks.h" |
| 42 #include "webrtc/rtc_base/constructormagic.h" | 42 #include "webrtc/rtc_base/constructormagic.h" |
| 43 #include "webrtc/rtc_base/location.h" | 43 #include "webrtc/rtc_base/location.h" |
| 44 #include "webrtc/rtc_base/logging.h" | 44 #include "webrtc/rtc_base/logging.h" |
| 45 #include "webrtc/rtc_base/optional.h" | 45 #include "webrtc/rtc_base/optional.h" |
| 46 #include "webrtc/rtc_base/ptr_util.h" | 46 #include "webrtc/rtc_base/ptr_util.h" |
| 47 #include "webrtc/rtc_base/sequenced_task_checker.h" |
| 47 #include "webrtc/rtc_base/task_queue.h" | 48 #include "webrtc/rtc_base/task_queue.h" |
| 48 #include "webrtc/rtc_base/thread_annotations.h" | 49 #include "webrtc/rtc_base/thread_annotations.h" |
| 49 #include "webrtc/rtc_base/thread_checker.h" | |
| 50 #include "webrtc/rtc_base/trace_event.h" | 50 #include "webrtc/rtc_base/trace_event.h" |
| 51 #include "webrtc/system_wrappers/include/clock.h" | 51 #include "webrtc/system_wrappers/include/clock.h" |
| 52 #include "webrtc/system_wrappers/include/cpu_info.h" | 52 #include "webrtc/system_wrappers/include/cpu_info.h" |
| 53 #include "webrtc/system_wrappers/include/metrics.h" | 53 #include "webrtc/system_wrappers/include/metrics.h" |
| 54 #include "webrtc/system_wrappers/include/rw_lock_wrapper.h" | 54 #include "webrtc/system_wrappers/include/rw_lock_wrapper.h" |
| 55 #include "webrtc/system_wrappers/include/trace.h" | 55 #include "webrtc/system_wrappers/include/trace.h" |
| 56 #include "webrtc/video/call_stats.h" | 56 #include "webrtc/video/call_stats.h" |
| 57 #include "webrtc/video/send_delay_stats.h" | 57 #include "webrtc/video/send_delay_stats.h" |
| 58 #include "webrtc/video/stats_counter.h" | 58 #include "webrtc/video/stats_counter.h" |
| 59 #include "webrtc/video/video_receive_stream.h" | 59 #include "webrtc/video/video_receive_stream.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 void UpdateCurrentBitrateConfig(const rtc::Optional<int>& new_start); | 252 void UpdateCurrentBitrateConfig(const rtc::Optional<int>& new_start); |
| 253 | 253 |
| 254 Clock* const clock_; | 254 Clock* const clock_; |
| 255 | 255 |
| 256 const int num_cpu_cores_; | 256 const int num_cpu_cores_; |
| 257 const std::unique_ptr<ProcessThread> module_process_thread_; | 257 const std::unique_ptr<ProcessThread> module_process_thread_; |
| 258 const std::unique_ptr<ProcessThread> pacer_thread_; | 258 const std::unique_ptr<ProcessThread> pacer_thread_; |
| 259 const std::unique_ptr<CallStats> call_stats_; | 259 const std::unique_ptr<CallStats> call_stats_; |
| 260 const std::unique_ptr<BitrateAllocator> bitrate_allocator_; | 260 const std::unique_ptr<BitrateAllocator> bitrate_allocator_; |
| 261 Call::Config config_; | 261 Call::Config config_; |
| 262 rtc::ThreadChecker configuration_thread_checker_; | 262 rtc::SequencedTaskChecker configuration_sequence_checker_; |
| 263 | 263 |
| 264 NetworkState audio_network_state_; | 264 NetworkState audio_network_state_; |
| 265 NetworkState video_network_state_; | 265 NetworkState video_network_state_; |
| 266 | 266 |
| 267 std::unique_ptr<RWLockWrapper> receive_crit_; | 267 std::unique_ptr<RWLockWrapper> receive_crit_; |
| 268 // Audio, Video, and FlexFEC receive streams are owned by the client that | 268 // Audio, Video, and FlexFEC receive streams are owned by the client that |
| 269 // creates them. | 269 // creates them. |
| 270 std::set<AudioReceiveStream*> audio_receive_streams_ | 270 std::set<AudioReceiveStream*> audio_receive_streams_ |
| 271 GUARDED_BY(receive_crit_); | 271 GUARDED_BY(receive_crit_); |
| 272 std::set<VideoReceiveStream*> video_receive_streams_ | 272 std::set<VideoReceiveStream*> video_receive_streams_ |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 GUARDED_BY(receive_crit_); | 305 GUARDED_BY(receive_crit_); |
| 306 | 306 |
| 307 std::unique_ptr<RWLockWrapper> send_crit_; | 307 std::unique_ptr<RWLockWrapper> send_crit_; |
| 308 // Audio and Video send streams are owned by the client that creates them. | 308 // Audio and Video send streams are owned by the client that creates them. |
| 309 std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_); | 309 std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_); |
| 310 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_); | 310 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_); |
| 311 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_); | 311 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_); |
| 312 | 312 |
| 313 using RtpStateMap = std::map<uint32_t, RtpState>; | 313 using RtpStateMap = std::map<uint32_t, RtpState>; |
| 314 RtpStateMap suspended_audio_send_ssrcs_ | 314 RtpStateMap suspended_audio_send_ssrcs_ |
| 315 GUARDED_BY(configuration_thread_checker_); | 315 GUARDED_BY(configuration_sequence_checker_); |
| 316 RtpStateMap suspended_video_send_ssrcs_ | 316 RtpStateMap suspended_video_send_ssrcs_ |
| 317 GUARDED_BY(configuration_thread_checker_); | 317 GUARDED_BY(configuration_sequence_checker_); |
| 318 | 318 |
| 319 webrtc::RtcEventLog* event_log_; | 319 webrtc::RtcEventLog* event_log_; |
| 320 | 320 |
| 321 // The following members are only accessed (exclusively) from one thread and | 321 // The following members are only accessed (exclusively) from one thread and |
| 322 // from the destructor, and therefore doesn't need any explicit | 322 // from the destructor, and therefore doesn't need any explicit |
| 323 // synchronization. | 323 // synchronization. |
| 324 RateCounter received_bytes_per_second_counter_; | 324 RateCounter received_bytes_per_second_counter_; |
| 325 RateCounter received_audio_bytes_per_second_counter_; | 325 RateCounter received_audio_bytes_per_second_counter_; |
| 326 RateCounter received_video_bytes_per_second_counter_; | 326 RateCounter received_video_bytes_per_second_counter_; |
| 327 RateCounter received_rtcp_bytes_per_second_counter_; | 327 RateCounter received_rtcp_bytes_per_second_counter_; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 RTC_FROM_HERE); | 442 RTC_FROM_HERE); |
| 443 pacer_thread_->RegisterModule(transport_send_->send_side_cc()->pacer(), | 443 pacer_thread_->RegisterModule(transport_send_->send_side_cc()->pacer(), |
| 444 RTC_FROM_HERE); | 444 RTC_FROM_HERE); |
| 445 pacer_thread_->RegisterModule( | 445 pacer_thread_->RegisterModule( |
| 446 receive_side_cc_.GetRemoteBitrateEstimator(true), RTC_FROM_HERE); | 446 receive_side_cc_.GetRemoteBitrateEstimator(true), RTC_FROM_HERE); |
| 447 | 447 |
| 448 pacer_thread_->Start(); | 448 pacer_thread_->Start(); |
| 449 } | 449 } |
| 450 | 450 |
| 451 Call::~Call() { | 451 Call::~Call() { |
| 452 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 452 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 453 | 453 |
| 454 RTC_CHECK(audio_send_ssrcs_.empty()); | 454 RTC_CHECK(audio_send_ssrcs_.empty()); |
| 455 RTC_CHECK(video_send_ssrcs_.empty()); | 455 RTC_CHECK(video_send_ssrcs_.empty()); |
| 456 RTC_CHECK(video_send_streams_.empty()); | 456 RTC_CHECK(video_send_streams_.empty()); |
| 457 RTC_CHECK(audio_receive_streams_.empty()); | 457 RTC_CHECK(audio_receive_streams_.empty()); |
| 458 RTC_CHECK(video_receive_streams_.empty()); | 458 RTC_CHECK(video_receive_streams_.empty()); |
| 459 | 459 |
| 460 pacer_thread_->Stop(); | 460 pacer_thread_->Stop(); |
| 461 pacer_thread_->DeRegisterModule(transport_send_->send_side_cc()->pacer()); | 461 pacer_thread_->DeRegisterModule(transport_send_->send_side_cc()->pacer()); |
| 462 pacer_thread_->DeRegisterModule( | 462 pacer_thread_->DeRegisterModule( |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.BitrateReceivedInKbps", | 580 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.BitrateReceivedInKbps", |
| 581 recv_bytes_per_sec.average * 8 / 1000); | 581 recv_bytes_per_sec.average * 8 / 1000); |
| 582 LOG(LS_INFO) << "WebRTC.Call.BitrateReceivedInBps, " | 582 LOG(LS_INFO) << "WebRTC.Call.BitrateReceivedInBps, " |
| 583 << recv_bytes_per_sec.ToStringWithMultiplier(8); | 583 << recv_bytes_per_sec.ToStringWithMultiplier(8); |
| 584 } | 584 } |
| 585 } | 585 } |
| 586 | 586 |
| 587 PacketReceiver* Call::Receiver() { | 587 PacketReceiver* Call::Receiver() { |
| 588 // TODO(solenberg): Some test cases in EndToEndTest use this from a different | 588 // TODO(solenberg): Some test cases in EndToEndTest use this from a different |
| 589 // thread. Re-enable once that is fixed. | 589 // thread. Re-enable once that is fixed. |
| 590 // RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 590 // RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 591 return this; | 591 return this; |
| 592 } | 592 } |
| 593 | 593 |
| 594 webrtc::AudioSendStream* Call::CreateAudioSendStream( | 594 webrtc::AudioSendStream* Call::CreateAudioSendStream( |
| 595 const webrtc::AudioSendStream::Config& config) { | 595 const webrtc::AudioSendStream::Config& config) { |
| 596 TRACE_EVENT0("webrtc", "Call::CreateAudioSendStream"); | 596 TRACE_EVENT0("webrtc", "Call::CreateAudioSendStream"); |
| 597 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 597 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 598 event_log_->LogAudioSendStreamConfig(CreateRtcLogStreamConfig(config)); | 598 event_log_->LogAudioSendStreamConfig(CreateRtcLogStreamConfig(config)); |
| 599 | 599 |
| 600 rtc::Optional<RtpState> suspended_rtp_state; | 600 rtc::Optional<RtpState> suspended_rtp_state; |
| 601 { | 601 { |
| 602 const auto& iter = suspended_audio_send_ssrcs_.find(config.rtp.ssrc); | 602 const auto& iter = suspended_audio_send_ssrcs_.find(config.rtp.ssrc); |
| 603 if (iter != suspended_audio_send_ssrcs_.end()) { | 603 if (iter != suspended_audio_send_ssrcs_.end()) { |
| 604 suspended_rtp_state.emplace(iter->second); | 604 suspended_rtp_state.emplace(iter->second); |
| 605 } | 605 } |
| 606 } | 606 } |
| 607 | 607 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 623 } | 623 } |
| 624 } | 624 } |
| 625 } | 625 } |
| 626 send_stream->SignalNetworkState(audio_network_state_); | 626 send_stream->SignalNetworkState(audio_network_state_); |
| 627 UpdateAggregateNetworkState(); | 627 UpdateAggregateNetworkState(); |
| 628 return send_stream; | 628 return send_stream; |
| 629 } | 629 } |
| 630 | 630 |
| 631 void Call::DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) { | 631 void Call::DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) { |
| 632 TRACE_EVENT0("webrtc", "Call::DestroyAudioSendStream"); | 632 TRACE_EVENT0("webrtc", "Call::DestroyAudioSendStream"); |
| 633 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 633 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 634 RTC_DCHECK(send_stream != nullptr); | 634 RTC_DCHECK(send_stream != nullptr); |
| 635 | 635 |
| 636 send_stream->Stop(); | 636 send_stream->Stop(); |
| 637 | 637 |
| 638 const uint32_t ssrc = send_stream->GetConfig().rtp.ssrc; | 638 const uint32_t ssrc = send_stream->GetConfig().rtp.ssrc; |
| 639 webrtc::internal::AudioSendStream* audio_send_stream = | 639 webrtc::internal::AudioSendStream* audio_send_stream = |
| 640 static_cast<webrtc::internal::AudioSendStream*>(send_stream); | 640 static_cast<webrtc::internal::AudioSendStream*>(send_stream); |
| 641 suspended_audio_send_ssrcs_[ssrc] = audio_send_stream->GetRtpState(); | 641 suspended_audio_send_ssrcs_[ssrc] = audio_send_stream->GetRtpState(); |
| 642 { | 642 { |
| 643 WriteLockScoped write_lock(*send_crit_); | 643 WriteLockScoped write_lock(*send_crit_); |
| 644 size_t num_deleted = audio_send_ssrcs_.erase(ssrc); | 644 size_t num_deleted = audio_send_ssrcs_.erase(ssrc); |
| 645 RTC_DCHECK_EQ(1, num_deleted); | 645 RTC_DCHECK_EQ(1, num_deleted); |
| 646 } | 646 } |
| 647 { | 647 { |
| 648 ReadLockScoped read_lock(*receive_crit_); | 648 ReadLockScoped read_lock(*receive_crit_); |
| 649 for (AudioReceiveStream* stream : audio_receive_streams_) { | 649 for (AudioReceiveStream* stream : audio_receive_streams_) { |
| 650 if (stream->config().rtp.local_ssrc == ssrc) { | 650 if (stream->config().rtp.local_ssrc == ssrc) { |
| 651 stream->AssociateSendStream(nullptr); | 651 stream->AssociateSendStream(nullptr); |
| 652 } | 652 } |
| 653 } | 653 } |
| 654 } | 654 } |
| 655 UpdateAggregateNetworkState(); | 655 UpdateAggregateNetworkState(); |
| 656 sent_rtp_audio_timer_ms_.Extend(audio_send_stream->GetActiveLifetime()); | 656 sent_rtp_audio_timer_ms_.Extend(audio_send_stream->GetActiveLifetime()); |
| 657 delete send_stream; | 657 delete send_stream; |
| 658 } | 658 } |
| 659 | 659 |
| 660 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( | 660 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( |
| 661 const webrtc::AudioReceiveStream::Config& config) { | 661 const webrtc::AudioReceiveStream::Config& config) { |
| 662 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); | 662 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); |
| 663 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 663 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 664 event_log_->LogAudioReceiveStreamConfig(CreateRtcLogStreamConfig(config)); | 664 event_log_->LogAudioReceiveStreamConfig(CreateRtcLogStreamConfig(config)); |
| 665 AudioReceiveStream* receive_stream = new AudioReceiveStream( | 665 AudioReceiveStream* receive_stream = new AudioReceiveStream( |
| 666 &audio_receiver_controller_, transport_send_->packet_router(), config, | 666 &audio_receiver_controller_, transport_send_->packet_router(), config, |
| 667 config_.audio_state, event_log_); | 667 config_.audio_state, event_log_); |
| 668 { | 668 { |
| 669 WriteLockScoped write_lock(*receive_crit_); | 669 WriteLockScoped write_lock(*receive_crit_); |
| 670 receive_rtp_config_[config.rtp.remote_ssrc] = | 670 receive_rtp_config_[config.rtp.remote_ssrc] = |
| 671 ReceiveRtpConfig(config.rtp.extensions, UseSendSideBwe(config)); | 671 ReceiveRtpConfig(config.rtp.extensions, UseSendSideBwe(config)); |
| 672 audio_receive_streams_.insert(receive_stream); | 672 audio_receive_streams_.insert(receive_stream); |
| 673 | 673 |
| 674 ConfigureSync(config.sync_group); | 674 ConfigureSync(config.sync_group); |
| 675 } | 675 } |
| 676 { | 676 { |
| 677 ReadLockScoped read_lock(*send_crit_); | 677 ReadLockScoped read_lock(*send_crit_); |
| 678 auto it = audio_send_ssrcs_.find(config.rtp.local_ssrc); | 678 auto it = audio_send_ssrcs_.find(config.rtp.local_ssrc); |
| 679 if (it != audio_send_ssrcs_.end()) { | 679 if (it != audio_send_ssrcs_.end()) { |
| 680 receive_stream->AssociateSendStream(it->second); | 680 receive_stream->AssociateSendStream(it->second); |
| 681 } | 681 } |
| 682 } | 682 } |
| 683 receive_stream->SignalNetworkState(audio_network_state_); | 683 receive_stream->SignalNetworkState(audio_network_state_); |
| 684 UpdateAggregateNetworkState(); | 684 UpdateAggregateNetworkState(); |
| 685 return receive_stream; | 685 return receive_stream; |
| 686 } | 686 } |
| 687 | 687 |
| 688 void Call::DestroyAudioReceiveStream( | 688 void Call::DestroyAudioReceiveStream( |
| 689 webrtc::AudioReceiveStream* receive_stream) { | 689 webrtc::AudioReceiveStream* receive_stream) { |
| 690 TRACE_EVENT0("webrtc", "Call::DestroyAudioReceiveStream"); | 690 TRACE_EVENT0("webrtc", "Call::DestroyAudioReceiveStream"); |
| 691 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 691 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 692 RTC_DCHECK(receive_stream != nullptr); | 692 RTC_DCHECK(receive_stream != nullptr); |
| 693 webrtc::internal::AudioReceiveStream* audio_receive_stream = | 693 webrtc::internal::AudioReceiveStream* audio_receive_stream = |
| 694 static_cast<webrtc::internal::AudioReceiveStream*>(receive_stream); | 694 static_cast<webrtc::internal::AudioReceiveStream*>(receive_stream); |
| 695 { | 695 { |
| 696 WriteLockScoped write_lock(*receive_crit_); | 696 WriteLockScoped write_lock(*receive_crit_); |
| 697 const AudioReceiveStream::Config& config = audio_receive_stream->config(); | 697 const AudioReceiveStream::Config& config = audio_receive_stream->config(); |
| 698 uint32_t ssrc = config.rtp.remote_ssrc; | 698 uint32_t ssrc = config.rtp.remote_ssrc; |
| 699 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) | 699 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) |
| 700 ->RemoveStream(ssrc); | 700 ->RemoveStream(ssrc); |
| 701 audio_receive_streams_.erase(audio_receive_stream); | 701 audio_receive_streams_.erase(audio_receive_stream); |
| 702 const std::string& sync_group = audio_receive_stream->config().sync_group; | 702 const std::string& sync_group = audio_receive_stream->config().sync_group; |
| 703 const auto it = sync_stream_mapping_.find(sync_group); | 703 const auto it = sync_stream_mapping_.find(sync_group); |
| 704 if (it != sync_stream_mapping_.end() && | 704 if (it != sync_stream_mapping_.end() && |
| 705 it->second == audio_receive_stream) { | 705 it->second == audio_receive_stream) { |
| 706 sync_stream_mapping_.erase(it); | 706 sync_stream_mapping_.erase(it); |
| 707 ConfigureSync(sync_group); | 707 ConfigureSync(sync_group); |
| 708 } | 708 } |
| 709 receive_rtp_config_.erase(ssrc); | 709 receive_rtp_config_.erase(ssrc); |
| 710 } | 710 } |
| 711 UpdateAggregateNetworkState(); | 711 UpdateAggregateNetworkState(); |
| 712 delete audio_receive_stream; | 712 delete audio_receive_stream; |
| 713 } | 713 } |
| 714 | 714 |
| 715 webrtc::VideoSendStream* Call::CreateVideoSendStream( | 715 webrtc::VideoSendStream* Call::CreateVideoSendStream( |
| 716 webrtc::VideoSendStream::Config config, | 716 webrtc::VideoSendStream::Config config, |
| 717 VideoEncoderConfig encoder_config) { | 717 VideoEncoderConfig encoder_config) { |
| 718 TRACE_EVENT0("webrtc", "Call::CreateVideoSendStream"); | 718 TRACE_EVENT0("webrtc", "Call::CreateVideoSendStream"); |
| 719 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 719 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 720 | 720 |
| 721 video_send_delay_stats_->AddSsrcs(config); | 721 video_send_delay_stats_->AddSsrcs(config); |
| 722 for (size_t ssrc_index = 0; ssrc_index < config.rtp.ssrcs.size(); | 722 for (size_t ssrc_index = 0; ssrc_index < config.rtp.ssrcs.size(); |
| 723 ++ssrc_index) { | 723 ++ssrc_index) { |
| 724 event_log_->LogVideoSendStreamConfig( | 724 event_log_->LogVideoSendStreamConfig( |
| 725 CreateRtcLogStreamConfig(config, ssrc_index)); | 725 CreateRtcLogStreamConfig(config, ssrc_index)); |
| 726 } | 726 } |
| 727 | 727 |
| 728 // TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if | 728 // TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if |
| 729 // the call has already started. | 729 // the call has already started. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 745 } | 745 } |
| 746 send_stream->SignalNetworkState(video_network_state_); | 746 send_stream->SignalNetworkState(video_network_state_); |
| 747 UpdateAggregateNetworkState(); | 747 UpdateAggregateNetworkState(); |
| 748 | 748 |
| 749 return send_stream; | 749 return send_stream; |
| 750 } | 750 } |
| 751 | 751 |
| 752 void Call::DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) { | 752 void Call::DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) { |
| 753 TRACE_EVENT0("webrtc", "Call::DestroyVideoSendStream"); | 753 TRACE_EVENT0("webrtc", "Call::DestroyVideoSendStream"); |
| 754 RTC_DCHECK(send_stream != nullptr); | 754 RTC_DCHECK(send_stream != nullptr); |
| 755 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 755 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 756 | 756 |
| 757 send_stream->Stop(); | 757 send_stream->Stop(); |
| 758 | 758 |
| 759 VideoSendStream* send_stream_impl = nullptr; | 759 VideoSendStream* send_stream_impl = nullptr; |
| 760 { | 760 { |
| 761 WriteLockScoped write_lock(*send_crit_); | 761 WriteLockScoped write_lock(*send_crit_); |
| 762 auto it = video_send_ssrcs_.begin(); | 762 auto it = video_send_ssrcs_.begin(); |
| 763 while (it != video_send_ssrcs_.end()) { | 763 while (it != video_send_ssrcs_.end()) { |
| 764 if (it->second == static_cast<VideoSendStream*>(send_stream)) { | 764 if (it->second == static_cast<VideoSendStream*>(send_stream)) { |
| 765 send_stream_impl = it->second; | 765 send_stream_impl = it->second; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 780 suspended_video_send_ssrcs_[it->first] = it->second; | 780 suspended_video_send_ssrcs_[it->first] = it->second; |
| 781 } | 781 } |
| 782 | 782 |
| 783 UpdateAggregateNetworkState(); | 783 UpdateAggregateNetworkState(); |
| 784 delete send_stream_impl; | 784 delete send_stream_impl; |
| 785 } | 785 } |
| 786 | 786 |
| 787 webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream( | 787 webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream( |
| 788 webrtc::VideoReceiveStream::Config configuration) { | 788 webrtc::VideoReceiveStream::Config configuration) { |
| 789 TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream"); | 789 TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream"); |
| 790 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 790 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 791 | 791 |
| 792 VideoReceiveStream* receive_stream = new VideoReceiveStream( | 792 VideoReceiveStream* receive_stream = new VideoReceiveStream( |
| 793 &video_receiver_controller_, num_cpu_cores_, | 793 &video_receiver_controller_, num_cpu_cores_, |
| 794 transport_send_->packet_router(), std::move(configuration), | 794 transport_send_->packet_router(), std::move(configuration), |
| 795 module_process_thread_.get(), call_stats_.get()); | 795 module_process_thread_.get(), call_stats_.get()); |
| 796 | 796 |
| 797 const webrtc::VideoReceiveStream::Config& config = receive_stream->config(); | 797 const webrtc::VideoReceiveStream::Config& config = receive_stream->config(); |
| 798 ReceiveRtpConfig receive_config(config.rtp.extensions, | 798 ReceiveRtpConfig receive_config(config.rtp.extensions, |
| 799 UseSendSideBwe(config)); | 799 UseSendSideBwe(config)); |
| 800 { | 800 { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 812 } | 812 } |
| 813 receive_stream->SignalNetworkState(video_network_state_); | 813 receive_stream->SignalNetworkState(video_network_state_); |
| 814 UpdateAggregateNetworkState(); | 814 UpdateAggregateNetworkState(); |
| 815 event_log_->LogVideoReceiveStreamConfig(CreateRtcLogStreamConfig(config)); | 815 event_log_->LogVideoReceiveStreamConfig(CreateRtcLogStreamConfig(config)); |
| 816 return receive_stream; | 816 return receive_stream; |
| 817 } | 817 } |
| 818 | 818 |
| 819 void Call::DestroyVideoReceiveStream( | 819 void Call::DestroyVideoReceiveStream( |
| 820 webrtc::VideoReceiveStream* receive_stream) { | 820 webrtc::VideoReceiveStream* receive_stream) { |
| 821 TRACE_EVENT0("webrtc", "Call::DestroyVideoReceiveStream"); | 821 TRACE_EVENT0("webrtc", "Call::DestroyVideoReceiveStream"); |
| 822 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 822 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 823 RTC_DCHECK(receive_stream != nullptr); | 823 RTC_DCHECK(receive_stream != nullptr); |
| 824 VideoReceiveStream* receive_stream_impl = | 824 VideoReceiveStream* receive_stream_impl = |
| 825 static_cast<VideoReceiveStream*>(receive_stream); | 825 static_cast<VideoReceiveStream*>(receive_stream); |
| 826 const VideoReceiveStream::Config& config = receive_stream_impl->config(); | 826 const VideoReceiveStream::Config& config = receive_stream_impl->config(); |
| 827 { | 827 { |
| 828 WriteLockScoped write_lock(*receive_crit_); | 828 WriteLockScoped write_lock(*receive_crit_); |
| 829 // Remove all ssrcs pointing to a receive stream. As RTX retransmits on a | 829 // Remove all ssrcs pointing to a receive stream. As RTX retransmits on a |
| 830 // separate SSRC there can be either one or two. | 830 // separate SSRC there can be either one or two. |
| 831 receive_rtp_config_.erase(config.rtp.remote_ssrc); | 831 receive_rtp_config_.erase(config.rtp.remote_ssrc); |
| 832 if (config.rtp.rtx_ssrc) { | 832 if (config.rtp.rtx_ssrc) { |
| 833 receive_rtp_config_.erase(config.rtp.rtx_ssrc); | 833 receive_rtp_config_.erase(config.rtp.rtx_ssrc); |
| 834 } | 834 } |
| 835 video_receive_streams_.erase(receive_stream_impl); | 835 video_receive_streams_.erase(receive_stream_impl); |
| 836 ConfigureSync(config.sync_group); | 836 ConfigureSync(config.sync_group); |
| 837 } | 837 } |
| 838 | 838 |
| 839 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) | 839 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) |
| 840 ->RemoveStream(config.rtp.remote_ssrc); | 840 ->RemoveStream(config.rtp.remote_ssrc); |
| 841 | 841 |
| 842 UpdateAggregateNetworkState(); | 842 UpdateAggregateNetworkState(); |
| 843 delete receive_stream_impl; | 843 delete receive_stream_impl; |
| 844 } | 844 } |
| 845 | 845 |
| 846 FlexfecReceiveStream* Call::CreateFlexfecReceiveStream( | 846 FlexfecReceiveStream* Call::CreateFlexfecReceiveStream( |
| 847 const FlexfecReceiveStream::Config& config) { | 847 const FlexfecReceiveStream::Config& config) { |
| 848 TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream"); | 848 TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream"); |
| 849 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 849 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 850 | 850 |
| 851 RecoveredPacketReceiver* recovered_packet_receiver = this; | 851 RecoveredPacketReceiver* recovered_packet_receiver = this; |
| 852 | 852 |
| 853 FlexfecReceiveStreamImpl* receive_stream; | 853 FlexfecReceiveStreamImpl* receive_stream; |
| 854 { | 854 { |
| 855 WriteLockScoped write_lock(*receive_crit_); | 855 WriteLockScoped write_lock(*receive_crit_); |
| 856 // Unlike the video and audio receive streams, | 856 // Unlike the video and audio receive streams, |
| 857 // FlexfecReceiveStream implements RtpPacketSinkInterface itself, | 857 // FlexfecReceiveStream implements RtpPacketSinkInterface itself, |
| 858 // and hence its constructor passes its |this| pointer to | 858 // and hence its constructor passes its |this| pointer to |
| 859 // video_receiver_controller_->CreateStream(). Calling the | 859 // video_receiver_controller_->CreateStream(). Calling the |
| (...skipping 12 matching lines...) Expand all Loading... |
| 872 ReceiveRtpConfig(config.rtp_header_extensions, UseSendSideBwe(config)); | 872 ReceiveRtpConfig(config.rtp_header_extensions, UseSendSideBwe(config)); |
| 873 } | 873 } |
| 874 | 874 |
| 875 // TODO(brandtr): Store config in RtcEventLog here. | 875 // TODO(brandtr): Store config in RtcEventLog here. |
| 876 | 876 |
| 877 return receive_stream; | 877 return receive_stream; |
| 878 } | 878 } |
| 879 | 879 |
| 880 void Call::DestroyFlexfecReceiveStream(FlexfecReceiveStream* receive_stream) { | 880 void Call::DestroyFlexfecReceiveStream(FlexfecReceiveStream* receive_stream) { |
| 881 TRACE_EVENT0("webrtc", "Call::DestroyFlexfecReceiveStream"); | 881 TRACE_EVENT0("webrtc", "Call::DestroyFlexfecReceiveStream"); |
| 882 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 882 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 883 | 883 |
| 884 RTC_DCHECK(receive_stream != nullptr); | 884 RTC_DCHECK(receive_stream != nullptr); |
| 885 { | 885 { |
| 886 WriteLockScoped write_lock(*receive_crit_); | 886 WriteLockScoped write_lock(*receive_crit_); |
| 887 | 887 |
| 888 const FlexfecReceiveStream::Config& config = receive_stream->GetConfig(); | 888 const FlexfecReceiveStream::Config& config = receive_stream->GetConfig(); |
| 889 uint32_t ssrc = config.remote_ssrc; | 889 uint32_t ssrc = config.remote_ssrc; |
| 890 receive_rtp_config_.erase(ssrc); | 890 receive_rtp_config_.erase(ssrc); |
| 891 | 891 |
| 892 // Remove all SSRCs pointing to the FlexfecReceiveStreamImpl to be | 892 // Remove all SSRCs pointing to the FlexfecReceiveStreamImpl to be |
| 893 // destroyed. | 893 // destroyed. |
| 894 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) | 894 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) |
| 895 ->RemoveStream(ssrc); | 895 ->RemoveStream(ssrc); |
| 896 } | 896 } |
| 897 | 897 |
| 898 delete receive_stream; | 898 delete receive_stream; |
| 899 } | 899 } |
| 900 | 900 |
| 901 Call::Stats Call::GetStats() const { | 901 Call::Stats Call::GetStats() const { |
| 902 // TODO(solenberg): Some test cases in EndToEndTest use this from a different | 902 // TODO(solenberg): Some test cases in EndToEndTest use this from a different |
| 903 // thread. Re-enable once that is fixed. | 903 // thread. Re-enable once that is fixed. |
| 904 // RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 904 // RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 905 Stats stats; | 905 Stats stats; |
| 906 // Fetch available send/receive bitrates. | 906 // Fetch available send/receive bitrates. |
| 907 uint32_t send_bandwidth = 0; | 907 uint32_t send_bandwidth = 0; |
| 908 transport_send_->send_side_cc()->GetBitrateController()->AvailableBandwidth( | 908 transport_send_->send_side_cc()->GetBitrateController()->AvailableBandwidth( |
| 909 &send_bandwidth); | 909 &send_bandwidth); |
| 910 std::vector<unsigned int> ssrcs; | 910 std::vector<unsigned int> ssrcs; |
| 911 uint32_t recv_bandwidth = 0; | 911 uint32_t recv_bandwidth = 0; |
| 912 receive_side_cc_.GetRemoteBitrateEstimator(false)->LatestEstimate( | 912 receive_side_cc_.GetRemoteBitrateEstimator(false)->LatestEstimate( |
| 913 &ssrcs, &recv_bandwidth); | 913 &ssrcs, &recv_bandwidth); |
| 914 stats.send_bandwidth_bps = send_bandwidth; | 914 stats.send_bandwidth_bps = send_bandwidth; |
| 915 stats.recv_bandwidth_bps = recv_bandwidth; | 915 stats.recv_bandwidth_bps = recv_bandwidth; |
| 916 stats.pacer_delay_ms = | 916 stats.pacer_delay_ms = |
| 917 transport_send_->send_side_cc()->GetPacerQueuingDelayMs(); | 917 transport_send_->send_side_cc()->GetPacerQueuingDelayMs(); |
| 918 stats.rtt_ms = call_stats_->rtcp_rtt_stats()->LastProcessedRtt(); | 918 stats.rtt_ms = call_stats_->rtcp_rtt_stats()->LastProcessedRtt(); |
| 919 { | 919 { |
| 920 rtc::CritScope cs(&bitrate_crit_); | 920 rtc::CritScope cs(&bitrate_crit_); |
| 921 stats.max_padding_bitrate_bps = configured_max_padding_bitrate_bps_; | 921 stats.max_padding_bitrate_bps = configured_max_padding_bitrate_bps_; |
| 922 } | 922 } |
| 923 return stats; | 923 return stats; |
| 924 } | 924 } |
| 925 | 925 |
| 926 void Call::SetBitrateConfig( | 926 void Call::SetBitrateConfig( |
| 927 const webrtc::Call::Config::BitrateConfig& bitrate_config) { | 927 const webrtc::Call::Config::BitrateConfig& bitrate_config) { |
| 928 TRACE_EVENT0("webrtc", "Call::SetBitrateConfig"); | 928 TRACE_EVENT0("webrtc", "Call::SetBitrateConfig"); |
| 929 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 929 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 930 RTC_DCHECK_GE(bitrate_config.min_bitrate_bps, 0); | 930 RTC_DCHECK_GE(bitrate_config.min_bitrate_bps, 0); |
| 931 RTC_DCHECK_NE(bitrate_config.start_bitrate_bps, 0); | 931 RTC_DCHECK_NE(bitrate_config.start_bitrate_bps, 0); |
| 932 if (bitrate_config.max_bitrate_bps != -1) { | 932 if (bitrate_config.max_bitrate_bps != -1) { |
| 933 RTC_DCHECK_GT(bitrate_config.max_bitrate_bps, 0); | 933 RTC_DCHECK_GT(bitrate_config.max_bitrate_bps, 0); |
| 934 } | 934 } |
| 935 | 935 |
| 936 rtc::Optional<int> new_start; | 936 rtc::Optional<int> new_start; |
| 937 // Only update the "start" bitrate if it's set, and different from the old | 937 // Only update the "start" bitrate if it's set, and different from the old |
| 938 // value. In practice, this value comes from the x-google-start-bitrate codec | 938 // value. In practice, this value comes from the x-google-start-bitrate codec |
| 939 // parameter in SDP, and setting the same remote description twice shouldn't | 939 // parameter in SDP, and setting the same remote description twice shouldn't |
| 940 // restart bandwidth estimation. | 940 // restart bandwidth estimation. |
| 941 if (bitrate_config.start_bitrate_bps != -1 && | 941 if (bitrate_config.start_bitrate_bps != -1 && |
| 942 bitrate_config.start_bitrate_bps != | 942 bitrate_config.start_bitrate_bps != |
| 943 base_bitrate_config_.start_bitrate_bps) { | 943 base_bitrate_config_.start_bitrate_bps) { |
| 944 new_start.emplace(bitrate_config.start_bitrate_bps); | 944 new_start.emplace(bitrate_config.start_bitrate_bps); |
| 945 } | 945 } |
| 946 base_bitrate_config_ = bitrate_config; | 946 base_bitrate_config_ = bitrate_config; |
| 947 UpdateCurrentBitrateConfig(new_start); | 947 UpdateCurrentBitrateConfig(new_start); |
| 948 } | 948 } |
| 949 | 949 |
| 950 void Call::SetBitrateConfigMask( | 950 void Call::SetBitrateConfigMask( |
| 951 const webrtc::Call::Config::BitrateConfigMask& mask) { | 951 const webrtc::Call::Config::BitrateConfigMask& mask) { |
| 952 TRACE_EVENT0("webrtc", "Call::SetBitrateConfigMask"); | 952 TRACE_EVENT0("webrtc", "Call::SetBitrateConfigMask"); |
| 953 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 953 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 954 | 954 |
| 955 bitrate_config_mask_ = mask; | 955 bitrate_config_mask_ = mask; |
| 956 UpdateCurrentBitrateConfig(mask.start_bitrate_bps); | 956 UpdateCurrentBitrateConfig(mask.start_bitrate_bps); |
| 957 } | 957 } |
| 958 | 958 |
| 959 void Call::UpdateCurrentBitrateConfig(const rtc::Optional<int>& new_start) { | 959 void Call::UpdateCurrentBitrateConfig(const rtc::Optional<int>& new_start) { |
| 960 Config::BitrateConfig updated; | 960 Config::BitrateConfig updated; |
| 961 updated.min_bitrate_bps = | 961 updated.min_bitrate_bps = |
| 962 std::max(bitrate_config_mask_.min_bitrate_bps.value_or(0), | 962 std::max(bitrate_config_mask_.min_bitrate_bps.value_or(0), |
| 963 base_bitrate_config_.min_bitrate_bps); | 963 base_bitrate_config_.min_bitrate_bps); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 transport_send_->send_side_cc()->SetBweBitrates(updated.min_bitrate_bps, | 998 transport_send_->send_side_cc()->SetBweBitrates(updated.min_bitrate_bps, |
| 999 updated.start_bitrate_bps, | 999 updated.start_bitrate_bps, |
| 1000 updated.max_bitrate_bps); | 1000 updated.max_bitrate_bps); |
| 1001 if (!new_start) { | 1001 if (!new_start) { |
| 1002 updated.start_bitrate_bps = config_.bitrate_config.start_bitrate_bps; | 1002 updated.start_bitrate_bps = config_.bitrate_config.start_bitrate_bps; |
| 1003 } | 1003 } |
| 1004 config_.bitrate_config = updated; | 1004 config_.bitrate_config = updated; |
| 1005 } | 1005 } |
| 1006 | 1006 |
| 1007 void Call::SignalChannelNetworkState(MediaType media, NetworkState state) { | 1007 void Call::SignalChannelNetworkState(MediaType media, NetworkState state) { |
| 1008 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 1008 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 1009 switch (media) { | 1009 switch (media) { |
| 1010 case MediaType::AUDIO: | 1010 case MediaType::AUDIO: |
| 1011 audio_network_state_ = state; | 1011 audio_network_state_ = state; |
| 1012 break; | 1012 break; |
| 1013 case MediaType::VIDEO: | 1013 case MediaType::VIDEO: |
| 1014 video_network_state_ = state; | 1014 video_network_state_ = state; |
| 1015 break; | 1015 break; |
| 1016 case MediaType::ANY: | 1016 case MediaType::ANY: |
| 1017 case MediaType::DATA: | 1017 case MediaType::DATA: |
| 1018 RTC_NOTREACHED(); | 1018 RTC_NOTREACHED(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 case MediaType::ANY: | 1060 case MediaType::ANY: |
| 1061 case MediaType::DATA: | 1061 case MediaType::DATA: |
| 1062 RTC_NOTREACHED(); | 1062 RTC_NOTREACHED(); |
| 1063 break; | 1063 break; |
| 1064 } | 1064 } |
| 1065 } | 1065 } |
| 1066 | 1066 |
| 1067 // TODO(honghaiz): Add tests for this method. | 1067 // TODO(honghaiz): Add tests for this method. |
| 1068 void Call::OnNetworkRouteChanged(const std::string& transport_name, | 1068 void Call::OnNetworkRouteChanged(const std::string& transport_name, |
| 1069 const rtc::NetworkRoute& network_route) { | 1069 const rtc::NetworkRoute& network_route) { |
| 1070 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 1070 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 1071 // Check if the network route is connected. | 1071 // Check if the network route is connected. |
| 1072 if (!network_route.connected) { | 1072 if (!network_route.connected) { |
| 1073 LOG(LS_INFO) << "Transport " << transport_name << " is disconnected"; | 1073 LOG(LS_INFO) << "Transport " << transport_name << " is disconnected"; |
| 1074 // TODO(honghaiz): Perhaps handle this in SignalChannelNetworkState and | 1074 // TODO(honghaiz): Perhaps handle this in SignalChannelNetworkState and |
| 1075 // consider merging these two methods. | 1075 // consider merging these two methods. |
| 1076 return; | 1076 return; |
| 1077 } | 1077 } |
| 1078 | 1078 |
| 1079 // Check whether the network route has changed on each transport. | 1079 // Check whether the network route has changed on each transport. |
| 1080 auto result = | 1080 auto result = |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1097 << " bps."; | 1097 << " bps."; |
| 1098 RTC_DCHECK_GT(config_.bitrate_config.start_bitrate_bps, 0); | 1098 RTC_DCHECK_GT(config_.bitrate_config.start_bitrate_bps, 0); |
| 1099 transport_send_->send_side_cc()->OnNetworkRouteChanged( | 1099 transport_send_->send_side_cc()->OnNetworkRouteChanged( |
| 1100 network_route, config_.bitrate_config.start_bitrate_bps, | 1100 network_route, config_.bitrate_config.start_bitrate_bps, |
| 1101 config_.bitrate_config.min_bitrate_bps, | 1101 config_.bitrate_config.min_bitrate_bps, |
| 1102 config_.bitrate_config.max_bitrate_bps); | 1102 config_.bitrate_config.max_bitrate_bps); |
| 1103 } | 1103 } |
| 1104 } | 1104 } |
| 1105 | 1105 |
| 1106 void Call::UpdateAggregateNetworkState() { | 1106 void Call::UpdateAggregateNetworkState() { |
| 1107 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 1107 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 1108 | 1108 |
| 1109 bool have_audio = false; | 1109 bool have_audio = false; |
| 1110 bool have_video = false; | 1110 bool have_video = false; |
| 1111 { | 1111 { |
| 1112 ReadLockScoped read_lock(*send_crit_); | 1112 ReadLockScoped read_lock(*send_crit_); |
| 1113 if (audio_send_ssrcs_.size() > 0) | 1113 if (audio_send_ssrcs_.size() > 0) |
| 1114 have_audio = true; | 1114 have_audio = true; |
| 1115 if (video_send_ssrcs_.size() > 0) | 1115 if (video_send_ssrcs_.size() > 0) |
| 1116 have_video = true; | 1116 have_video = true; |
| 1117 } | 1117 } |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1363 } | 1363 } |
| 1364 | 1364 |
| 1365 PacketReceiver::DeliveryStatus Call::DeliverPacket( | 1365 PacketReceiver::DeliveryStatus Call::DeliverPacket( |
| 1366 MediaType media_type, | 1366 MediaType media_type, |
| 1367 const uint8_t* packet, | 1367 const uint8_t* packet, |
| 1368 size_t length, | 1368 size_t length, |
| 1369 const PacketTime& packet_time) { | 1369 const PacketTime& packet_time) { |
| 1370 // TODO(solenberg): Tests call this function on a network thread, libjingle | 1370 // TODO(solenberg): Tests call this function on a network thread, libjingle |
| 1371 // calls on the worker thread. We should move towards always using a network | 1371 // calls on the worker thread. We should move towards always using a network |
| 1372 // thread. Then this check can be enabled. | 1372 // thread. Then this check can be enabled. |
| 1373 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); | 1373 // RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 1374 if (RtpHeaderParser::IsRtcp(packet, length)) | 1374 if (RtpHeaderParser::IsRtcp(packet, length)) |
| 1375 return DeliverRtcp(media_type, packet, length); | 1375 return DeliverRtcp(media_type, packet, length); |
| 1376 | 1376 |
| 1377 return DeliverRtp(media_type, packet, length, packet_time); | 1377 return DeliverRtp(media_type, packet, length, packet_time); |
| 1378 } | 1378 } |
| 1379 | 1379 |
| 1380 // TODO(brandtr): Update this member function when we support protecting | 1380 // TODO(brandtr): Update this member function when we support protecting |
| 1381 // audio packets with FlexFEC. | 1381 // audio packets with FlexFEC. |
| 1382 void Call::OnRecoveredPacket(const uint8_t* packet, size_t length) { | 1382 void Call::OnRecoveredPacket(const uint8_t* packet, size_t length) { |
| 1383 ReadLockScoped read_lock(*receive_crit_); | 1383 ReadLockScoped read_lock(*receive_crit_); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1415 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { | 1415 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { |
| 1416 receive_side_cc_.OnReceivedPacket( | 1416 receive_side_cc_.OnReceivedPacket( |
| 1417 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), | 1417 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), |
| 1418 header); | 1418 header); |
| 1419 } | 1419 } |
| 1420 } | 1420 } |
| 1421 | 1421 |
| 1422 } // namespace internal | 1422 } // namespace internal |
| 1423 | 1423 |
| 1424 } // namespace webrtc | 1424 } // namespace webrtc |
| OLD | NEW |