| 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_ |
| 273 GUARDED_BY(receive_crit_); | 273 GUARDED_BY(receive_crit_); |
| 274 | 274 |
| 275 std::map<std::string, AudioReceiveStream*> sync_stream_mapping_ | 275 std::map<std::string, AudioReceiveStream*> sync_stream_mapping_ |
| 276 GUARDED_BY(receive_crit_); | 276 GUARDED_BY(receive_crit_); |
| 277 | 277 |
| 278 // TODO(nisse): Should eventually be injected at creation, | 278 // TODO(nisse): Should eventually be injected at creation, |
| 279 // with a single object in the bundled case. | 279 // with a single object in the bundled case. |
| 280 RtpStreamReceiverController audio_receiver_controller; | 280 RtpStreamReceiverController audio_receiver_controller_; |
| 281 RtpStreamReceiverController video_receiver_controller; | 281 RtpStreamReceiverController video_receiver_controller_; |
| 282 | 282 |
| 283 // This extra map is used for receive processing which is | 283 // This extra map is used for receive processing which is |
| 284 // independent of media type. | 284 // independent of media type. |
| 285 | 285 |
| 286 // TODO(nisse): In the RTP transport refactoring, we should have a | 286 // TODO(nisse): In the RTP transport refactoring, we should have a |
| 287 // single mapping from ssrc to a more abstract receive stream, with | 287 // single mapping from ssrc to a more abstract receive stream, with |
| 288 // accessor methods for all configuration we need at this level. | 288 // accessor methods for all configuration we need at this level. |
| 289 struct ReceiveRtpConfig { | 289 struct ReceiveRtpConfig { |
| 290 ReceiveRtpConfig() = default; // Needed by std::map | 290 ReceiveRtpConfig() = default; // Needed by std::map |
| 291 ReceiveRtpConfig(const std::vector<RtpExtension>& extensions, | 291 ReceiveRtpConfig(const std::vector<RtpExtension>& extensions, |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 UpdateAggregateNetworkState(); | 636 UpdateAggregateNetworkState(); |
| 637 delete audio_send_stream; | 637 delete audio_send_stream; |
| 638 } | 638 } |
| 639 | 639 |
| 640 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( | 640 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( |
| 641 const webrtc::AudioReceiveStream::Config& config) { | 641 const webrtc::AudioReceiveStream::Config& config) { |
| 642 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); | 642 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); |
| 643 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 643 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); |
| 644 event_log_->LogAudioReceiveStreamConfig(CreateRtcLogStreamConfig(config)); | 644 event_log_->LogAudioReceiveStreamConfig(CreateRtcLogStreamConfig(config)); |
| 645 AudioReceiveStream* receive_stream = new AudioReceiveStream( | 645 AudioReceiveStream* receive_stream = new AudioReceiveStream( |
| 646 &audio_receiver_controller, transport_send_->packet_router(), config, | 646 &audio_receiver_controller_, transport_send_->packet_router(), config, |
| 647 config_.audio_state, event_log_); | 647 config_.audio_state, event_log_); |
| 648 { | 648 { |
| 649 WriteLockScoped write_lock(*receive_crit_); | 649 WriteLockScoped write_lock(*receive_crit_); |
| 650 receive_rtp_config_[config.rtp.remote_ssrc] = | 650 receive_rtp_config_[config.rtp.remote_ssrc] = |
| 651 ReceiveRtpConfig(config.rtp.extensions, UseSendSideBwe(config)); | 651 ReceiveRtpConfig(config.rtp.extensions, UseSendSideBwe(config)); |
| 652 audio_receive_streams_.insert(receive_stream); | 652 audio_receive_streams_.insert(receive_stream); |
| 653 | 653 |
| 654 ConfigureSync(config.sync_group); | 654 ConfigureSync(config.sync_group); |
| 655 } | 655 } |
| 656 { | 656 { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 UpdateAggregateNetworkState(); | 763 UpdateAggregateNetworkState(); |
| 764 delete send_stream_impl; | 764 delete send_stream_impl; |
| 765 } | 765 } |
| 766 | 766 |
| 767 webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream( | 767 webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream( |
| 768 webrtc::VideoReceiveStream::Config configuration) { | 768 webrtc::VideoReceiveStream::Config configuration) { |
| 769 TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream"); | 769 TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream"); |
| 770 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 770 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); |
| 771 | 771 |
| 772 VideoReceiveStream* receive_stream = new VideoReceiveStream( | 772 VideoReceiveStream* receive_stream = new VideoReceiveStream( |
| 773 &video_receiver_controller, num_cpu_cores_, | 773 &video_receiver_controller_, num_cpu_cores_, |
| 774 transport_send_->packet_router(), std::move(configuration), | 774 transport_send_->packet_router(), std::move(configuration), |
| 775 module_process_thread_.get(), call_stats_.get()); | 775 module_process_thread_.get(), call_stats_.get()); |
| 776 | 776 |
| 777 const webrtc::VideoReceiveStream::Config& config = receive_stream->config(); | 777 const webrtc::VideoReceiveStream::Config& config = receive_stream->config(); |
| 778 ReceiveRtpConfig receive_config(config.rtp.extensions, | 778 ReceiveRtpConfig receive_config(config.rtp.extensions, |
| 779 UseSendSideBwe(config)); | 779 UseSendSideBwe(config)); |
| 780 { | 780 { |
| 781 WriteLockScoped write_lock(*receive_crit_); | 781 WriteLockScoped write_lock(*receive_crit_); |
| 782 if (config.rtp.rtx_ssrc) { | 782 if (config.rtp.rtx_ssrc) { |
| 783 // We record identical config for the rtx stream as for the main | 783 // We record identical config for the rtx stream as for the main |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 829 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); |
| 830 | 830 |
| 831 RecoveredPacketReceiver* recovered_packet_receiver = this; | 831 RecoveredPacketReceiver* recovered_packet_receiver = this; |
| 832 | 832 |
| 833 FlexfecReceiveStreamImpl* receive_stream; | 833 FlexfecReceiveStreamImpl* receive_stream; |
| 834 { | 834 { |
| 835 WriteLockScoped write_lock(*receive_crit_); | 835 WriteLockScoped write_lock(*receive_crit_); |
| 836 // Unlike the video and audio receive streams, | 836 // Unlike the video and audio receive streams, |
| 837 // FlexfecReceiveStream implements RtpPacketSinkInterface itself, | 837 // FlexfecReceiveStream implements RtpPacketSinkInterface itself, |
| 838 // and hence its constructor passes its |this| pointer to | 838 // and hence its constructor passes its |this| pointer to |
| 839 // video_receiver_controller->CreateStream(). Calling the | 839 // video_receiver_controller_->CreateStream(). Calling the |
| 840 // constructor while holding |receive_crit_| ensures that we don't | 840 // constructor while holding |receive_crit_| ensures that we don't |
| 841 // call OnRtpPacket until the constructor is finished and the | 841 // call OnRtpPacket until the constructor is finished and the |
| 842 // object is in a valid state. | 842 // object is in a valid state. |
| 843 // TODO(nisse): Fix constructor so that it can be moved outside of | 843 // TODO(nisse): Fix constructor so that it can be moved outside of |
| 844 // this locked scope. | 844 // this locked scope. |
| 845 receive_stream = new FlexfecReceiveStreamImpl( | 845 receive_stream = new FlexfecReceiveStreamImpl( |
| 846 &video_receiver_controller, config, recovered_packet_receiver, | 846 &video_receiver_controller_, config, recovered_packet_receiver, |
| 847 call_stats_->rtcp_rtt_stats(), module_process_thread_.get()); | 847 call_stats_->rtcp_rtt_stats(), module_process_thread_.get()); |
| 848 | 848 |
| 849 RTC_DCHECK(receive_rtp_config_.find(config.remote_ssrc) == | 849 RTC_DCHECK(receive_rtp_config_.find(config.remote_ssrc) == |
| 850 receive_rtp_config_.end()); | 850 receive_rtp_config_.end()); |
| 851 receive_rtp_config_[config.remote_ssrc] = | 851 receive_rtp_config_[config.remote_ssrc] = |
| 852 ReceiveRtpConfig(config.rtp_header_extensions, UseSendSideBwe(config)); | 852 ReceiveRtpConfig(config.rtp_header_extensions, UseSendSideBwe(config)); |
| 853 } | 853 } |
| 854 | 854 |
| 855 // TODO(brandtr): Store config in RtcEventLog here. | 855 // TODO(brandtr): Store config in RtcEventLog here. |
| 856 | 856 |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1306 // So by not passing the packet on to demuxing in this case, we prevent | 1306 // So by not passing the packet on to demuxing in this case, we prevent |
| 1307 // incoming packets to be passed on via the demuxer to a receive stream | 1307 // incoming packets to be passed on via the demuxer to a receive stream |
| 1308 // which is being torned down. | 1308 // which is being torned down. |
| 1309 return DELIVERY_UNKNOWN_SSRC; | 1309 return DELIVERY_UNKNOWN_SSRC; |
| 1310 } | 1310 } |
| 1311 parsed_packet->IdentifyExtensions(it->second.extensions); | 1311 parsed_packet->IdentifyExtensions(it->second.extensions); |
| 1312 | 1312 |
| 1313 NotifyBweOfReceivedPacket(*parsed_packet, media_type); | 1313 NotifyBweOfReceivedPacket(*parsed_packet, media_type); |
| 1314 | 1314 |
| 1315 if (media_type == MediaType::AUDIO) { | 1315 if (media_type == MediaType::AUDIO) { |
| 1316 if (audio_receiver_controller.OnRtpPacket(*parsed_packet)) { | 1316 if (audio_receiver_controller_.OnRtpPacket(*parsed_packet)) { |
| 1317 received_bytes_per_second_counter_.Add(static_cast<int>(length)); | 1317 received_bytes_per_second_counter_.Add(static_cast<int>(length)); |
| 1318 received_audio_bytes_per_second_counter_.Add(static_cast<int>(length)); | 1318 received_audio_bytes_per_second_counter_.Add(static_cast<int>(length)); |
| 1319 event_log_->LogRtpHeader(kIncomingPacket, packet, length); | 1319 event_log_->LogRtpHeader(kIncomingPacket, packet, length); |
| 1320 return DELIVERY_OK; | 1320 return DELIVERY_OK; |
| 1321 } | 1321 } |
| 1322 } else if (media_type == MediaType::VIDEO) { | 1322 } else if (media_type == MediaType::VIDEO) { |
| 1323 if (video_receiver_controller.OnRtpPacket(*parsed_packet)) { | 1323 if (video_receiver_controller_.OnRtpPacket(*parsed_packet)) { |
| 1324 received_bytes_per_second_counter_.Add(static_cast<int>(length)); | 1324 received_bytes_per_second_counter_.Add(static_cast<int>(length)); |
| 1325 received_video_bytes_per_second_counter_.Add(static_cast<int>(length)); | 1325 received_video_bytes_per_second_counter_.Add(static_cast<int>(length)); |
| 1326 event_log_->LogRtpHeader(kIncomingPacket, packet, length); | 1326 event_log_->LogRtpHeader(kIncomingPacket, packet, length); |
| 1327 return DELIVERY_OK; | 1327 return DELIVERY_OK; |
| 1328 } | 1328 } |
| 1329 } | 1329 } |
| 1330 return DELIVERY_UNKNOWN_SSRC; | 1330 return DELIVERY_UNKNOWN_SSRC; |
| 1331 } | 1331 } |
| 1332 | 1332 |
| 1333 PacketReceiver::DeliveryStatus Call::DeliverPacket( | 1333 PacketReceiver::DeliveryStatus Call::DeliverPacket( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1349 // audio packets with FlexFEC. | 1349 // audio packets with FlexFEC. |
| 1350 void Call::OnRecoveredPacket(const uint8_t* packet, size_t length) { | 1350 void Call::OnRecoveredPacket(const uint8_t* packet, size_t length) { |
| 1351 ReadLockScoped read_lock(*receive_crit_); | 1351 ReadLockScoped read_lock(*receive_crit_); |
| 1352 rtc::Optional<RtpPacketReceived> parsed_packet = | 1352 rtc::Optional<RtpPacketReceived> parsed_packet = |
| 1353 ParseRtpPacket(packet, length, nullptr); | 1353 ParseRtpPacket(packet, length, nullptr); |
| 1354 if (!parsed_packet) | 1354 if (!parsed_packet) |
| 1355 return; | 1355 return; |
| 1356 | 1356 |
| 1357 parsed_packet->set_recovered(true); | 1357 parsed_packet->set_recovered(true); |
| 1358 | 1358 |
| 1359 video_receiver_controller.OnRtpPacket(*parsed_packet); | 1359 video_receiver_controller_.OnRtpPacket(*parsed_packet); |
| 1360 } | 1360 } |
| 1361 | 1361 |
| 1362 void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, | 1362 void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, |
| 1363 MediaType media_type) { | 1363 MediaType media_type) { |
| 1364 auto it = receive_rtp_config_.find(packet.Ssrc()); | 1364 auto it = receive_rtp_config_.find(packet.Ssrc()); |
| 1365 bool use_send_side_bwe = | 1365 bool use_send_side_bwe = |
| 1366 (it != receive_rtp_config_.end()) && it->second.use_send_side_bwe; | 1366 (it != receive_rtp_config_.end()) && it->second.use_send_side_bwe; |
| 1367 | 1367 |
| 1368 RTPHeader header; | 1368 RTPHeader header; |
| 1369 packet.GetHeader(&header); | 1369 packet.GetHeader(&header); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1383 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { | 1383 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { |
| 1384 receive_side_cc_.OnReceivedPacket( | 1384 receive_side_cc_.OnReceivedPacket( |
| 1385 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), | 1385 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), |
| 1386 header); | 1386 header); |
| 1387 } | 1387 } |
| 1388 } | 1388 } |
| 1389 | 1389 |
| 1390 } // namespace internal | 1390 } // namespace internal |
| 1391 | 1391 |
| 1392 } // namespace webrtc | 1392 } // namespace webrtc |
| OLD | NEW |