| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 | 87 |
| 88 const int* FindKeyByValue(const std::map<int, int>& m, int v) { | 88 const int* FindKeyByValue(const std::map<int, int>& m, int v) { |
| 89 for (const auto& kv : m) { | 89 for (const auto& kv : m) { |
| 90 if (kv.second == v) | 90 if (kv.second == v) |
| 91 return &kv.first; | 91 return &kv.first; |
| 92 } | 92 } |
| 93 return nullptr; | 93 return nullptr; |
| 94 } | 94 } |
| 95 | 95 |
| 96 rtclog::StreamConfig CreateRtcLogStreamConfig( | 96 std::unique_ptr<rtclog::StreamConfig> CreateRtcLogStreamConfig( |
| 97 const VideoReceiveStream::Config& config) { | 97 const VideoReceiveStream::Config& config) { |
| 98 rtclog::StreamConfig rtclog_config; | 98 auto rtclog_config = rtc::MakeUnique<rtclog::StreamConfig>(); |
| 99 rtclog_config.remote_ssrc = config.rtp.remote_ssrc; | 99 rtclog_config->remote_ssrc = config.rtp.remote_ssrc; |
| 100 rtclog_config.local_ssrc = config.rtp.local_ssrc; | 100 rtclog_config->local_ssrc = config.rtp.local_ssrc; |
| 101 rtclog_config.rtx_ssrc = config.rtp.rtx_ssrc; | 101 rtclog_config->rtx_ssrc = config.rtp.rtx_ssrc; |
| 102 rtclog_config.rtcp_mode = config.rtp.rtcp_mode; | 102 rtclog_config->rtcp_mode = config.rtp.rtcp_mode; |
| 103 rtclog_config.remb = config.rtp.remb; | 103 rtclog_config->remb = config.rtp.remb; |
| 104 rtclog_config.rtp_extensions = config.rtp.extensions; | 104 rtclog_config->rtp_extensions = config.rtp.extensions; |
| 105 | 105 |
| 106 for (const auto& d : config.decoders) { | 106 for (const auto& d : config.decoders) { |
| 107 const int* search = | 107 const int* search = |
| 108 FindKeyByValue(config.rtp.rtx_associated_payload_types, d.payload_type); | 108 FindKeyByValue(config.rtp.rtx_associated_payload_types, d.payload_type); |
| 109 rtclog_config.codecs.emplace_back(d.payload_name, d.payload_type, | 109 rtclog_config->codecs.emplace_back(d.payload_name, d.payload_type, |
| 110 search ? *search : 0); | 110 search ? *search : 0); |
| 111 } | 111 } |
| 112 return rtclog_config; | 112 return rtclog_config; |
| 113 } | 113 } |
| 114 | 114 |
| 115 rtclog::StreamConfig CreateRtcLogStreamConfig( | 115 std::unique_ptr<rtclog::StreamConfig> CreateRtcLogStreamConfig( |
| 116 const VideoSendStream::Config& config, | 116 const VideoSendStream::Config& config, |
| 117 size_t ssrc_index) { | 117 size_t ssrc_index) { |
| 118 rtclog::StreamConfig rtclog_config; | 118 auto rtclog_config = rtc::MakeUnique<rtclog::StreamConfig>(); |
| 119 rtclog_config.local_ssrc = config.rtp.ssrcs[ssrc_index]; | 119 rtclog_config->local_ssrc = config.rtp.ssrcs[ssrc_index]; |
| 120 if (ssrc_index < config.rtp.rtx.ssrcs.size()) { | 120 if (ssrc_index < config.rtp.rtx.ssrcs.size()) { |
| 121 rtclog_config.rtx_ssrc = config.rtp.rtx.ssrcs[ssrc_index]; | 121 rtclog_config->rtx_ssrc = config.rtp.rtx.ssrcs[ssrc_index]; |
| 122 } | 122 } |
| 123 rtclog_config.rtcp_mode = config.rtp.rtcp_mode; | 123 rtclog_config->rtcp_mode = config.rtp.rtcp_mode; |
| 124 rtclog_config.rtp_extensions = config.rtp.extensions; | 124 rtclog_config->rtp_extensions = config.rtp.extensions; |
| 125 | 125 |
| 126 rtclog_config.codecs.emplace_back(config.encoder_settings.payload_name, | 126 rtclog_config->codecs.emplace_back(config.encoder_settings.payload_name, |
| 127 config.encoder_settings.payload_type, | 127 config.encoder_settings.payload_type, |
| 128 config.rtp.rtx.payload_type); | 128 config.rtp.rtx.payload_type); |
| 129 return rtclog_config; | 129 return rtclog_config; |
| 130 } | 130 } |
| 131 | 131 |
| 132 rtclog::StreamConfig CreateRtcLogStreamConfig( | 132 std::unique_ptr<rtclog::StreamConfig> CreateRtcLogStreamConfig( |
| 133 const AudioReceiveStream::Config& config) { | 133 const AudioReceiveStream::Config& config) { |
| 134 rtclog::StreamConfig rtclog_config; | 134 auto rtclog_config = rtc::MakeUnique<rtclog::StreamConfig>(); |
| 135 rtclog_config.remote_ssrc = config.rtp.remote_ssrc; | 135 rtclog_config->remote_ssrc = config.rtp.remote_ssrc; |
| 136 rtclog_config.local_ssrc = config.rtp.local_ssrc; | 136 rtclog_config->local_ssrc = config.rtp.local_ssrc; |
| 137 rtclog_config.rtp_extensions = config.rtp.extensions; | 137 rtclog_config->rtp_extensions = config.rtp.extensions; |
| 138 return rtclog_config; | 138 return rtclog_config; |
| 139 } | 139 } |
| 140 | 140 |
| 141 rtclog::StreamConfig CreateRtcLogStreamConfig( | 141 std::unique_ptr<rtclog::StreamConfig> CreateRtcLogStreamConfig( |
| 142 const AudioSendStream::Config& config) { | 142 const AudioSendStream::Config& config) { |
| 143 rtclog::StreamConfig rtclog_config; | 143 auto rtclog_config = rtc::MakeUnique<rtclog::StreamConfig>(); |
| 144 rtclog_config.local_ssrc = config.rtp.ssrc; | 144 rtclog_config->local_ssrc = config.rtp.ssrc; |
| 145 rtclog_config.rtp_extensions = config.rtp.extensions; | 145 rtclog_config->rtp_extensions = config.rtp.extensions; |
| 146 if (config.send_codec_spec) { | 146 if (config.send_codec_spec) { |
| 147 rtclog_config.codecs.emplace_back(config.send_codec_spec->format.name, | 147 rtclog_config->codecs.emplace_back(config.send_codec_spec->format.name, |
| 148 config.send_codec_spec->payload_type, 0); | 148 config.send_codec_spec->payload_type, 0); |
| 149 } | 149 } |
| 150 return rtclog_config; | 150 return rtclog_config; |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace | 153 } // namespace |
| 154 | 154 |
| 155 namespace internal { | 155 namespace internal { |
| 156 | 156 |
| 157 class Call : public webrtc::Call, | 157 class Call : public webrtc::Call, |
| 158 public PacketReceiver, | 158 public PacketReceiver, |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 | 598 |
| 599 PacketReceiver* Call::Receiver() { | 599 PacketReceiver* Call::Receiver() { |
| 600 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); | 600 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 601 return this; | 601 return this; |
| 602 } | 602 } |
| 603 | 603 |
| 604 webrtc::AudioSendStream* Call::CreateAudioSendStream( | 604 webrtc::AudioSendStream* Call::CreateAudioSendStream( |
| 605 const webrtc::AudioSendStream::Config& config) { | 605 const webrtc::AudioSendStream::Config& config) { |
| 606 TRACE_EVENT0("webrtc", "Call::CreateAudioSendStream"); | 606 TRACE_EVENT0("webrtc", "Call::CreateAudioSendStream"); |
| 607 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); | 607 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 608 event_log_->LogAudioSendStreamConfig(CreateRtcLogStreamConfig(config)); | 608 event_log_->LogAudioSendStreamConfig(*CreateRtcLogStreamConfig(config)); |
| 609 | 609 |
| 610 rtc::Optional<RtpState> suspended_rtp_state; | 610 rtc::Optional<RtpState> suspended_rtp_state; |
| 611 { | 611 { |
| 612 const auto& iter = suspended_audio_send_ssrcs_.find(config.rtp.ssrc); | 612 const auto& iter = suspended_audio_send_ssrcs_.find(config.rtp.ssrc); |
| 613 if (iter != suspended_audio_send_ssrcs_.end()) { | 613 if (iter != suspended_audio_send_ssrcs_.end()) { |
| 614 suspended_rtp_state.emplace(iter->second); | 614 suspended_rtp_state.emplace(iter->second); |
| 615 } | 615 } |
| 616 } | 616 } |
| 617 | 617 |
| 618 AudioSendStream* send_stream = new AudioSendStream( | 618 AudioSendStream* send_stream = new AudioSendStream( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 } | 664 } |
| 665 UpdateAggregateNetworkState(); | 665 UpdateAggregateNetworkState(); |
| 666 sent_rtp_audio_timer_ms_.Extend(audio_send_stream->GetActiveLifetime()); | 666 sent_rtp_audio_timer_ms_.Extend(audio_send_stream->GetActiveLifetime()); |
| 667 delete send_stream; | 667 delete send_stream; |
| 668 } | 668 } |
| 669 | 669 |
| 670 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( | 670 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( |
| 671 const webrtc::AudioReceiveStream::Config& config) { | 671 const webrtc::AudioReceiveStream::Config& config) { |
| 672 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); | 672 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); |
| 673 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); | 673 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 674 event_log_->LogAudioReceiveStreamConfig(CreateRtcLogStreamConfig(config)); | 674 event_log_->LogAudioReceiveStreamConfig(*CreateRtcLogStreamConfig(config)); |
| 675 AudioReceiveStream* receive_stream = new AudioReceiveStream( | 675 AudioReceiveStream* receive_stream = new AudioReceiveStream( |
| 676 &audio_receiver_controller_, transport_send_->packet_router(), config, | 676 &audio_receiver_controller_, transport_send_->packet_router(), config, |
| 677 config_.audio_state, event_log_); | 677 config_.audio_state, event_log_); |
| 678 { | 678 { |
| 679 WriteLockScoped write_lock(*receive_crit_); | 679 WriteLockScoped write_lock(*receive_crit_); |
| 680 receive_rtp_config_[config.rtp.remote_ssrc] = | 680 receive_rtp_config_[config.rtp.remote_ssrc] = |
| 681 ReceiveRtpConfig(config.rtp.extensions, UseSendSideBwe(config)); | 681 ReceiveRtpConfig(config.rtp.extensions, UseSendSideBwe(config)); |
| 682 audio_receive_streams_.insert(receive_stream); | 682 audio_receive_streams_.insert(receive_stream); |
| 683 | 683 |
| 684 ConfigureSync(config.sync_group); | 684 ConfigureSync(config.sync_group); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 webrtc::VideoSendStream* Call::CreateVideoSendStream( | 725 webrtc::VideoSendStream* Call::CreateVideoSendStream( |
| 726 webrtc::VideoSendStream::Config config, | 726 webrtc::VideoSendStream::Config config, |
| 727 VideoEncoderConfig encoder_config) { | 727 VideoEncoderConfig encoder_config) { |
| 728 TRACE_EVENT0("webrtc", "Call::CreateVideoSendStream"); | 728 TRACE_EVENT0("webrtc", "Call::CreateVideoSendStream"); |
| 729 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); | 729 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 730 | 730 |
| 731 video_send_delay_stats_->AddSsrcs(config); | 731 video_send_delay_stats_->AddSsrcs(config); |
| 732 for (size_t ssrc_index = 0; ssrc_index < config.rtp.ssrcs.size(); | 732 for (size_t ssrc_index = 0; ssrc_index < config.rtp.ssrcs.size(); |
| 733 ++ssrc_index) { | 733 ++ssrc_index) { |
| 734 event_log_->LogVideoSendStreamConfig( | 734 event_log_->LogVideoSendStreamConfig( |
| 735 CreateRtcLogStreamConfig(config, ssrc_index)); | 735 *CreateRtcLogStreamConfig(config, ssrc_index)); |
| 736 } | 736 } |
| 737 | 737 |
| 738 // TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if | 738 // TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if |
| 739 // the call has already started. | 739 // the call has already started. |
| 740 // Copy ssrcs from |config| since |config| is moved. | 740 // Copy ssrcs from |config| since |config| is moved. |
| 741 std::vector<uint32_t> ssrcs = config.rtp.ssrcs; | 741 std::vector<uint32_t> ssrcs = config.rtp.ssrcs; |
| 742 VideoSendStream* send_stream = new VideoSendStream( | 742 VideoSendStream* send_stream = new VideoSendStream( |
| 743 num_cpu_cores_, module_process_thread_.get(), &worker_queue_, | 743 num_cpu_cores_, module_process_thread_.get(), &worker_queue_, |
| 744 call_stats_.get(), transport_send_.get(), bitrate_allocator_.get(), | 744 call_stats_.get(), transport_send_.get(), bitrate_allocator_.get(), |
| 745 video_send_delay_stats_.get(), event_log_, std::move(config), | 745 video_send_delay_stats_.get(), event_log_, std::move(config), |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 // type, we may get an incorrect value for the rtx stream, but | 815 // type, we may get an incorrect value for the rtx stream, but |
| 816 // that is unlikely to matter in practice. | 816 // that is unlikely to matter in practice. |
| 817 receive_rtp_config_[config.rtp.rtx_ssrc] = receive_config; | 817 receive_rtp_config_[config.rtp.rtx_ssrc] = receive_config; |
| 818 } | 818 } |
| 819 receive_rtp_config_[config.rtp.remote_ssrc] = receive_config; | 819 receive_rtp_config_[config.rtp.remote_ssrc] = receive_config; |
| 820 video_receive_streams_.insert(receive_stream); | 820 video_receive_streams_.insert(receive_stream); |
| 821 ConfigureSync(config.sync_group); | 821 ConfigureSync(config.sync_group); |
| 822 } | 822 } |
| 823 receive_stream->SignalNetworkState(video_network_state_); | 823 receive_stream->SignalNetworkState(video_network_state_); |
| 824 UpdateAggregateNetworkState(); | 824 UpdateAggregateNetworkState(); |
| 825 event_log_->LogVideoReceiveStreamConfig(CreateRtcLogStreamConfig(config)); | 825 event_log_->LogVideoReceiveStreamConfig(*CreateRtcLogStreamConfig(config)); |
| 826 return receive_stream; | 826 return receive_stream; |
| 827 } | 827 } |
| 828 | 828 |
| 829 void Call::DestroyVideoReceiveStream( | 829 void Call::DestroyVideoReceiveStream( |
| 830 webrtc::VideoReceiveStream* receive_stream) { | 830 webrtc::VideoReceiveStream* receive_stream) { |
| 831 TRACE_EVENT0("webrtc", "Call::DestroyVideoReceiveStream"); | 831 TRACE_EVENT0("webrtc", "Call::DestroyVideoReceiveStream"); |
| 832 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); | 832 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
| 833 RTC_DCHECK(receive_stream != nullptr); | 833 RTC_DCHECK(receive_stream != nullptr); |
| 834 VideoReceiveStream* receive_stream_impl = | 834 VideoReceiveStream* receive_stream_impl = |
| 835 static_cast<VideoReceiveStream*>(receive_stream); | 835 static_cast<VideoReceiveStream*>(receive_stream); |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { | 1435 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { |
| 1436 receive_side_cc_.OnReceivedPacket( | 1436 receive_side_cc_.OnReceivedPacket( |
| 1437 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), | 1437 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), |
| 1438 header); | 1438 header); |
| 1439 } | 1439 } |
| 1440 } | 1440 } |
| 1441 | 1441 |
| 1442 } // namespace internal | 1442 } // namespace internal |
| 1443 | 1443 |
| 1444 } // namespace webrtc | 1444 } // namespace webrtc |
| OLD | NEW |