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 16 matching lines...) Expand all Loading... | |
27 #include "webrtc/base/logging.h" | 27 #include "webrtc/base/logging.h" |
28 #include "webrtc/base/optional.h" | 28 #include "webrtc/base/optional.h" |
29 #include "webrtc/base/ptr_util.h" | 29 #include "webrtc/base/ptr_util.h" |
30 #include "webrtc/base/task_queue.h" | 30 #include "webrtc/base/task_queue.h" |
31 #include "webrtc/base/thread_annotations.h" | 31 #include "webrtc/base/thread_annotations.h" |
32 #include "webrtc/base/thread_checker.h" | 32 #include "webrtc/base/thread_checker.h" |
33 #include "webrtc/base/trace_event.h" | 33 #include "webrtc/base/trace_event.h" |
34 #include "webrtc/call/bitrate_allocator.h" | 34 #include "webrtc/call/bitrate_allocator.h" |
35 #include "webrtc/call/call.h" | 35 #include "webrtc/call/call.h" |
36 #include "webrtc/call/flexfec_receive_stream_impl.h" | 36 #include "webrtc/call/flexfec_receive_stream_impl.h" |
37 #include "webrtc/call/rtp_demuxer.h" | 37 #include "webrtc/call/rtp_stream_receiver_controller.h" |
38 #include "webrtc/call/rtp_transport_controller_send.h" | 38 #include "webrtc/call/rtp_transport_controller_send.h" |
39 #include "webrtc/config.h" | 39 #include "webrtc/config.h" |
40 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 40 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
41 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 41 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
42 #include "webrtc/modules/congestion_controller/include/receive_side_congestion_c ontroller.h" | 42 #include "webrtc/modules/congestion_controller/include/receive_side_congestion_c ontroller.h" |
43 #include "webrtc/modules/pacing/paced_sender.h" | 43 #include "webrtc/modules/pacing/paced_sender.h" |
44 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" | 44 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" |
45 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 45 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
46 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 46 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
47 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" | 47 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 // Audio, Video, and FlexFEC receive streams are owned by the client that | 270 // Audio, Video, and FlexFEC receive streams are owned by the client that |
271 // creates them. | 271 // creates them. |
272 std::set<AudioReceiveStream*> audio_receive_streams_ | 272 std::set<AudioReceiveStream*> audio_receive_streams_ |
273 GUARDED_BY(receive_crit_); | 273 GUARDED_BY(receive_crit_); |
274 std::set<VideoReceiveStream*> video_receive_streams_ | 274 std::set<VideoReceiveStream*> video_receive_streams_ |
275 GUARDED_BY(receive_crit_); | 275 GUARDED_BY(receive_crit_); |
276 | 276 |
277 std::map<std::string, AudioReceiveStream*> sync_stream_mapping_ | 277 std::map<std::string, AudioReceiveStream*> sync_stream_mapping_ |
278 GUARDED_BY(receive_crit_); | 278 GUARDED_BY(receive_crit_); |
279 | 279 |
280 // TODO(nisse): Should eventually be part of injected | 280 // TODO(nisse): Should eventually be injected at creation, |
281 // RtpTransportControllerReceive, with a single demuxer in the bundled case. | 281 // with a single object in the bundled case. |
282 RtpDemuxer audio_rtp_demuxer_ GUARDED_BY(receive_crit_); | 282 RtpStreamReceiverController audio_receiver_controller; |
283 RtpDemuxer video_rtp_demuxer_ GUARDED_BY(receive_crit_); | 283 RtpStreamReceiverController video_receiver_controller; |
284 | 284 |
285 // This extra map is used for receive processing which is | 285 // This extra map is used for receive processing which is |
286 // independent of media type. | 286 // independent of media type. |
287 | 287 |
288 // TODO(nisse): In the RTP transport refactoring, we should have a | 288 // TODO(nisse): In the RTP transport refactoring, we should have a |
289 // single mapping from ssrc to a more abstract receive stream, with | 289 // single mapping from ssrc to a more abstract receive stream, with |
290 // accessor methods for all configuration we need at this level. | 290 // accessor methods for all configuration we need at this level. |
291 struct ReceiveRtpConfig { | 291 struct ReceiveRtpConfig { |
292 ReceiveRtpConfig() = default; // Needed by std::map | 292 ReceiveRtpConfig() = default; // Needed by std::map |
293 ReceiveRtpConfig(const std::vector<RtpExtension>& extensions, | 293 ReceiveRtpConfig(const std::vector<RtpExtension>& extensions, |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
482 | 482 |
483 rtc::Optional<RtpPacketReceived> Call::ParseRtpPacket( | 483 rtc::Optional<RtpPacketReceived> Call::ParseRtpPacket( |
484 const uint8_t* packet, | 484 const uint8_t* packet, |
485 size_t length, | 485 size_t length, |
486 const PacketTime* packet_time) { | 486 const PacketTime* packet_time) { |
487 RtpPacketReceived parsed_packet; | 487 RtpPacketReceived parsed_packet; |
488 if (!parsed_packet.Parse(packet, length)) | 488 if (!parsed_packet.Parse(packet, length)) |
489 return rtc::Optional<RtpPacketReceived>(); | 489 return rtc::Optional<RtpPacketReceived>(); |
490 | 490 |
491 auto it = receive_rtp_config_.find(parsed_packet.Ssrc()); | 491 auto it = receive_rtp_config_.find(parsed_packet.Ssrc()); |
492 if (it != receive_rtp_config_.end()) | 492 if (it == receive_rtp_config_.end()) |
493 parsed_packet.IdentifyExtensions(it->second.extensions); | 493 // Destruction of the receive stream, including deregistering from the |
494 // RtpDemuxer, is not protected by the |receive_crit_| lock. But | |
495 // deregistering in the |receive_rtp_config_| map is protected by that lock. | |
496 // So by letting the parsing fail in this case, we prevent incoming packets | |
497 // to be passed on via the demuxer to a receive stream which is being torned | |
498 // down. | |
499 return rtc::Optional<RtpPacketReceived>(); | |
nisse-webrtc
2017/06/14 08:16:28
It seems this change breaks ortc tests, e.g., Ortc
| |
500 | |
501 parsed_packet.IdentifyExtensions(it->second.extensions); | |
494 | 502 |
495 int64_t arrival_time_ms; | 503 int64_t arrival_time_ms; |
496 if (packet_time && packet_time->timestamp != -1) { | 504 if (packet_time && packet_time->timestamp != -1) { |
497 arrival_time_ms = (packet_time->timestamp + 500) / 1000; | 505 arrival_time_ms = (packet_time->timestamp + 500) / 1000; |
498 } else { | 506 } else { |
499 arrival_time_ms = clock_->TimeInMilliseconds(); | 507 arrival_time_ms = clock_->TimeInMilliseconds(); |
500 } | 508 } |
501 parsed_packet.set_arrival_time_ms(arrival_time_ms); | 509 parsed_packet.set_arrival_time_ms(arrival_time_ms); |
502 | 510 |
503 return rtc::Optional<RtpPacketReceived>(std::move(parsed_packet)); | 511 return rtc::Optional<RtpPacketReceived>(std::move(parsed_packet)); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
641 } | 649 } |
642 UpdateAggregateNetworkState(); | 650 UpdateAggregateNetworkState(); |
643 delete audio_send_stream; | 651 delete audio_send_stream; |
644 } | 652 } |
645 | 653 |
646 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( | 654 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( |
647 const webrtc::AudioReceiveStream::Config& config) { | 655 const webrtc::AudioReceiveStream::Config& config) { |
648 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); | 656 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); |
649 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 657 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); |
650 event_log_->LogAudioReceiveStreamConfig(CreateRtcLogStreamConfig(config)); | 658 event_log_->LogAudioReceiveStreamConfig(CreateRtcLogStreamConfig(config)); |
651 AudioReceiveStream* receive_stream = | 659 AudioReceiveStream* receive_stream = new AudioReceiveStream( |
652 new AudioReceiveStream(transport_send_->packet_router(), config, | 660 &audio_receiver_controller, transport_send_->packet_router(), config, |
653 config_.audio_state, event_log_); | 661 config_.audio_state, event_log_); |
654 { | 662 { |
655 WriteLockScoped write_lock(*receive_crit_); | 663 WriteLockScoped write_lock(*receive_crit_); |
656 audio_rtp_demuxer_.AddSink(config.rtp.remote_ssrc, receive_stream); | |
657 receive_rtp_config_[config.rtp.remote_ssrc] = | 664 receive_rtp_config_[config.rtp.remote_ssrc] = |
658 ReceiveRtpConfig(config.rtp.extensions, UseSendSideBwe(config)); | 665 ReceiveRtpConfig(config.rtp.extensions, UseSendSideBwe(config)); |
659 audio_receive_streams_.insert(receive_stream); | 666 audio_receive_streams_.insert(receive_stream); |
660 | 667 |
661 ConfigureSync(config.sync_group); | 668 ConfigureSync(config.sync_group); |
662 } | 669 } |
663 { | 670 { |
664 ReadLockScoped read_lock(*send_crit_); | 671 ReadLockScoped read_lock(*send_crit_); |
665 auto it = audio_send_ssrcs_.find(config.rtp.local_ssrc); | 672 auto it = audio_send_ssrcs_.find(config.rtp.local_ssrc); |
666 if (it != audio_send_ssrcs_.end()) { | 673 if (it != audio_send_ssrcs_.end()) { |
(...skipping 11 matching lines...) Expand all Loading... | |
678 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 685 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); |
679 RTC_DCHECK(receive_stream != nullptr); | 686 RTC_DCHECK(receive_stream != nullptr); |
680 webrtc::internal::AudioReceiveStream* audio_receive_stream = | 687 webrtc::internal::AudioReceiveStream* audio_receive_stream = |
681 static_cast<webrtc::internal::AudioReceiveStream*>(receive_stream); | 688 static_cast<webrtc::internal::AudioReceiveStream*>(receive_stream); |
682 { | 689 { |
683 WriteLockScoped write_lock(*receive_crit_); | 690 WriteLockScoped write_lock(*receive_crit_); |
684 const AudioReceiveStream::Config& config = audio_receive_stream->config(); | 691 const AudioReceiveStream::Config& config = audio_receive_stream->config(); |
685 uint32_t ssrc = config.rtp.remote_ssrc; | 692 uint32_t ssrc = config.rtp.remote_ssrc; |
686 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) | 693 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) |
687 ->RemoveStream(ssrc); | 694 ->RemoveStream(ssrc); |
688 size_t num_deleted = audio_rtp_demuxer_.RemoveSink(audio_receive_stream); | |
689 RTC_DCHECK(num_deleted == 1); | |
690 audio_receive_streams_.erase(audio_receive_stream); | 695 audio_receive_streams_.erase(audio_receive_stream); |
691 const std::string& sync_group = audio_receive_stream->config().sync_group; | 696 const std::string& sync_group = audio_receive_stream->config().sync_group; |
692 const auto it = sync_stream_mapping_.find(sync_group); | 697 const auto it = sync_stream_mapping_.find(sync_group); |
693 if (it != sync_stream_mapping_.end() && | 698 if (it != sync_stream_mapping_.end() && |
694 it->second == audio_receive_stream) { | 699 it->second == audio_receive_stream) { |
695 sync_stream_mapping_.erase(it); | 700 sync_stream_mapping_.erase(it); |
696 ConfigureSync(sync_group); | 701 ConfigureSync(sync_group); |
697 } | 702 } |
698 receive_rtp_config_.erase(ssrc); | 703 receive_rtp_config_.erase(ssrc); |
699 } | 704 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
771 | 776 |
772 UpdateAggregateNetworkState(); | 777 UpdateAggregateNetworkState(); |
773 delete send_stream_impl; | 778 delete send_stream_impl; |
774 } | 779 } |
775 | 780 |
776 webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream( | 781 webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream( |
777 webrtc::VideoReceiveStream::Config configuration) { | 782 webrtc::VideoReceiveStream::Config configuration) { |
778 TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream"); | 783 TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream"); |
779 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 784 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); |
780 | 785 |
781 VideoReceiveStream* receive_stream = | 786 VideoReceiveStream* receive_stream = new VideoReceiveStream( |
782 new VideoReceiveStream(num_cpu_cores_, transport_send_->packet_router(), | 787 &video_receiver_controller, num_cpu_cores_, |
783 std::move(configuration), | 788 transport_send_->packet_router(), std::move(configuration), |
784 module_process_thread_.get(), call_stats_.get()); | 789 module_process_thread_.get(), call_stats_.get()); |
785 | 790 |
786 const webrtc::VideoReceiveStream::Config& config = receive_stream->config(); | 791 const webrtc::VideoReceiveStream::Config& config = receive_stream->config(); |
787 ReceiveRtpConfig receive_config(config.rtp.extensions, | 792 ReceiveRtpConfig receive_config(config.rtp.extensions, |
788 UseSendSideBwe(config)); | 793 UseSendSideBwe(config)); |
789 { | 794 { |
790 WriteLockScoped write_lock(*receive_crit_); | 795 WriteLockScoped write_lock(*receive_crit_); |
791 video_rtp_demuxer_.AddSink(config.rtp.remote_ssrc, receive_stream); | |
792 if (config.rtp.rtx_ssrc) { | 796 if (config.rtp.rtx_ssrc) { |
793 video_rtp_demuxer_.AddSink(config.rtp.rtx_ssrc, receive_stream); | |
794 // We record identical config for the rtx stream as for the main | 797 // We record identical config for the rtx stream as for the main |
795 // stream. Since the transport_send_cc negotiation is per payload | 798 // stream. Since the transport_send_cc negotiation is per payload |
796 // type, we may get an incorrect value for the rtx stream, but | 799 // type, we may get an incorrect value for the rtx stream, but |
797 // that is unlikely to matter in practice. | 800 // that is unlikely to matter in practice. |
798 receive_rtp_config_[config.rtp.rtx_ssrc] = receive_config; | 801 receive_rtp_config_[config.rtp.rtx_ssrc] = receive_config; |
799 } | 802 } |
800 receive_rtp_config_[config.rtp.remote_ssrc] = receive_config; | 803 receive_rtp_config_[config.rtp.remote_ssrc] = receive_config; |
801 video_receive_streams_.insert(receive_stream); | 804 video_receive_streams_.insert(receive_stream); |
802 ConfigureSync(config.sync_group); | 805 ConfigureSync(config.sync_group); |
803 } | 806 } |
804 receive_stream->SignalNetworkState(video_network_state_); | 807 receive_stream->SignalNetworkState(video_network_state_); |
805 UpdateAggregateNetworkState(); | 808 UpdateAggregateNetworkState(); |
806 event_log_->LogVideoReceiveStreamConfig(CreateRtcLogStreamConfig(config)); | 809 event_log_->LogVideoReceiveStreamConfig(CreateRtcLogStreamConfig(config)); |
807 return receive_stream; | 810 return receive_stream; |
808 } | 811 } |
809 | 812 |
810 void Call::DestroyVideoReceiveStream( | 813 void Call::DestroyVideoReceiveStream( |
811 webrtc::VideoReceiveStream* receive_stream) { | 814 webrtc::VideoReceiveStream* receive_stream) { |
812 TRACE_EVENT0("webrtc", "Call::DestroyVideoReceiveStream"); | 815 TRACE_EVENT0("webrtc", "Call::DestroyVideoReceiveStream"); |
813 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 816 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); |
814 RTC_DCHECK(receive_stream != nullptr); | 817 RTC_DCHECK(receive_stream != nullptr); |
815 VideoReceiveStream* receive_stream_impl = | 818 VideoReceiveStream* receive_stream_impl = |
816 static_cast<VideoReceiveStream*>(receive_stream); | 819 static_cast<VideoReceiveStream*>(receive_stream); |
817 const VideoReceiveStream::Config& config = receive_stream_impl->config(); | 820 const VideoReceiveStream::Config& config = receive_stream_impl->config(); |
818 { | 821 { |
819 WriteLockScoped write_lock(*receive_crit_); | 822 WriteLockScoped write_lock(*receive_crit_); |
820 // Remove all ssrcs pointing to a receive stream. As RTX retransmits on a | 823 // Remove all ssrcs pointing to a receive stream. As RTX retransmits on a |
821 // separate SSRC there can be either one or two. | 824 // separate SSRC there can be either one or two. |
822 size_t num_deleted = video_rtp_demuxer_.RemoveSink(receive_stream_impl); | |
823 RTC_DCHECK_GE(num_deleted, 1); | |
824 receive_rtp_config_.erase(config.rtp.remote_ssrc); | 825 receive_rtp_config_.erase(config.rtp.remote_ssrc); |
825 if (config.rtp.rtx_ssrc) { | 826 if (config.rtp.rtx_ssrc) { |
826 receive_rtp_config_.erase(config.rtp.rtx_ssrc); | 827 receive_rtp_config_.erase(config.rtp.rtx_ssrc); |
827 } | 828 } |
828 video_receive_streams_.erase(receive_stream_impl); | 829 video_receive_streams_.erase(receive_stream_impl); |
829 ConfigureSync(config.sync_group); | 830 ConfigureSync(config.sync_group); |
830 } | 831 } |
831 | 832 |
832 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) | 833 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) |
833 ->RemoveStream(config.rtp.remote_ssrc); | 834 ->RemoveStream(config.rtp.remote_ssrc); |
834 | 835 |
835 UpdateAggregateNetworkState(); | 836 UpdateAggregateNetworkState(); |
836 delete receive_stream_impl; | 837 delete receive_stream_impl; |
837 } | 838 } |
838 | 839 |
839 FlexfecReceiveStream* Call::CreateFlexfecReceiveStream( | 840 FlexfecReceiveStream* Call::CreateFlexfecReceiveStream( |
840 const FlexfecReceiveStream::Config& config) { | 841 const FlexfecReceiveStream::Config& config) { |
841 TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream"); | 842 TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream"); |
842 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 843 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); |
843 | 844 |
844 RecoveredPacketReceiver* recovered_packet_receiver = this; | 845 RecoveredPacketReceiver* recovered_packet_receiver = this; |
846 | |
845 FlexfecReceiveStreamImpl* receive_stream = new FlexfecReceiveStreamImpl( | 847 FlexfecReceiveStreamImpl* receive_stream = new FlexfecReceiveStreamImpl( |
846 config, recovered_packet_receiver, call_stats_->rtcp_rtt_stats(), | 848 &video_receiver_controller, config, recovered_packet_receiver, |
847 module_process_thread_.get()); | 849 call_stats_->rtcp_rtt_stats(), module_process_thread_.get()); |
848 | |
849 { | 850 { |
850 WriteLockScoped write_lock(*receive_crit_); | 851 WriteLockScoped write_lock(*receive_crit_); |
851 video_rtp_demuxer_.AddSink(config.remote_ssrc, receive_stream); | |
852 | |
853 for (auto ssrc : config.protected_media_ssrcs) | |
854 video_rtp_demuxer_.AddSink(ssrc, receive_stream); | |
855 | |
856 RTC_DCHECK(receive_rtp_config_.find(config.remote_ssrc) == | 852 RTC_DCHECK(receive_rtp_config_.find(config.remote_ssrc) == |
857 receive_rtp_config_.end()); | 853 receive_rtp_config_.end()); |
858 receive_rtp_config_[config.remote_ssrc] = | 854 receive_rtp_config_[config.remote_ssrc] = |
859 ReceiveRtpConfig(config.rtp_header_extensions, UseSendSideBwe(config)); | 855 ReceiveRtpConfig(config.rtp_header_extensions, UseSendSideBwe(config)); |
860 } | 856 } |
861 | 857 |
862 // TODO(brandtr): Store config in RtcEventLog here. | 858 // TODO(brandtr): Store config in RtcEventLog here. |
863 | 859 |
864 return receive_stream; | 860 return receive_stream; |
865 } | 861 } |
(...skipping 10 matching lines...) Expand all Loading... | |
876 { | 872 { |
877 WriteLockScoped write_lock(*receive_crit_); | 873 WriteLockScoped write_lock(*receive_crit_); |
878 | 874 |
879 const FlexfecReceiveStream::Config& config = | 875 const FlexfecReceiveStream::Config& config = |
880 receive_stream_impl->GetConfig(); | 876 receive_stream_impl->GetConfig(); |
881 uint32_t ssrc = config.remote_ssrc; | 877 uint32_t ssrc = config.remote_ssrc; |
882 receive_rtp_config_.erase(ssrc); | 878 receive_rtp_config_.erase(ssrc); |
883 | 879 |
884 // Remove all SSRCs pointing to the FlexfecReceiveStreamImpl to be | 880 // Remove all SSRCs pointing to the FlexfecReceiveStreamImpl to be |
885 // destroyed. | 881 // destroyed. |
886 video_rtp_demuxer_.RemoveSink(receive_stream_impl); | |
887 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) | 882 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) |
888 ->RemoveStream(ssrc); | 883 ->RemoveStream(ssrc); |
889 } | 884 } |
890 | 885 |
891 delete receive_stream_impl; | 886 delete receive_stream_impl; |
892 } | 887 } |
893 | 888 |
894 Call::Stats Call::GetStats() const { | 889 Call::Stats Call::GetStats() const { |
895 // TODO(solenberg): Some test cases in EndToEndTest use this from a different | 890 // TODO(solenberg): Some test cases in EndToEndTest use this from a different |
896 // thread. Re-enable once that is fixed. | 891 // thread. Re-enable once that is fixed. |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1314 // on parsed_packet to the receive streams. | 1309 // on parsed_packet to the receive streams. |
1315 rtc::Optional<RtpPacketReceived> parsed_packet = | 1310 rtc::Optional<RtpPacketReceived> parsed_packet = |
1316 ParseRtpPacket(packet, length, &packet_time); | 1311 ParseRtpPacket(packet, length, &packet_time); |
1317 | 1312 |
1318 if (!parsed_packet) | 1313 if (!parsed_packet) |
1319 return DELIVERY_PACKET_ERROR; | 1314 return DELIVERY_PACKET_ERROR; |
1320 | 1315 |
1321 NotifyBweOfReceivedPacket(*parsed_packet, media_type); | 1316 NotifyBweOfReceivedPacket(*parsed_packet, media_type); |
1322 | 1317 |
1323 if (media_type == MediaType::AUDIO) { | 1318 if (media_type == MediaType::AUDIO) { |
1324 if (audio_rtp_demuxer_.OnRtpPacket(*parsed_packet)) { | 1319 if (audio_receiver_controller.OnRtpPacket(*parsed_packet)) { |
1325 received_bytes_per_second_counter_.Add(static_cast<int>(length)); | 1320 received_bytes_per_second_counter_.Add(static_cast<int>(length)); |
1326 received_audio_bytes_per_second_counter_.Add(static_cast<int>(length)); | 1321 received_audio_bytes_per_second_counter_.Add(static_cast<int>(length)); |
1327 event_log_->LogRtpHeader(kIncomingPacket, packet, length); | 1322 event_log_->LogRtpHeader(kIncomingPacket, packet, length); |
1328 return DELIVERY_OK; | 1323 return DELIVERY_OK; |
1329 } | 1324 } |
1330 } else if (media_type == MediaType::VIDEO) { | 1325 } else if (media_type == MediaType::VIDEO) { |
1331 if (video_rtp_demuxer_.OnRtpPacket(*parsed_packet)) { | 1326 if (video_receiver_controller.OnRtpPacket(*parsed_packet)) { |
1332 received_bytes_per_second_counter_.Add(static_cast<int>(length)); | 1327 received_bytes_per_second_counter_.Add(static_cast<int>(length)); |
1333 received_video_bytes_per_second_counter_.Add(static_cast<int>(length)); | 1328 received_video_bytes_per_second_counter_.Add(static_cast<int>(length)); |
1334 event_log_->LogRtpHeader(kIncomingPacket, packet, length); | 1329 event_log_->LogRtpHeader(kIncomingPacket, packet, length); |
1335 return DELIVERY_OK; | 1330 return DELIVERY_OK; |
1336 } | 1331 } |
1337 } | 1332 } |
1338 return DELIVERY_UNKNOWN_SSRC; | 1333 return DELIVERY_UNKNOWN_SSRC; |
1339 } | 1334 } |
1340 | 1335 |
1341 PacketReceiver::DeliveryStatus Call::DeliverPacket( | 1336 PacketReceiver::DeliveryStatus Call::DeliverPacket( |
(...skipping 15 matching lines...) Expand all Loading... | |
1357 // audio packets with FlexFEC. | 1352 // audio packets with FlexFEC. |
1358 void Call::OnRecoveredPacket(const uint8_t* packet, size_t length) { | 1353 void Call::OnRecoveredPacket(const uint8_t* packet, size_t length) { |
1359 ReadLockScoped read_lock(*receive_crit_); | 1354 ReadLockScoped read_lock(*receive_crit_); |
1360 rtc::Optional<RtpPacketReceived> parsed_packet = | 1355 rtc::Optional<RtpPacketReceived> parsed_packet = |
1361 ParseRtpPacket(packet, length, nullptr); | 1356 ParseRtpPacket(packet, length, nullptr); |
1362 if (!parsed_packet) | 1357 if (!parsed_packet) |
1363 return; | 1358 return; |
1364 | 1359 |
1365 parsed_packet->set_recovered(true); | 1360 parsed_packet->set_recovered(true); |
1366 | 1361 |
1367 video_rtp_demuxer_.OnRtpPacket(*parsed_packet); | 1362 video_receiver_controller.OnRtpPacket(*parsed_packet); |
1368 } | 1363 } |
1369 | 1364 |
1370 void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, | 1365 void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, |
1371 MediaType media_type) { | 1366 MediaType media_type) { |
1372 auto it = receive_rtp_config_.find(packet.Ssrc()); | 1367 auto it = receive_rtp_config_.find(packet.Ssrc()); |
1373 bool use_send_side_bwe = | 1368 bool use_send_side_bwe = |
1374 (it != receive_rtp_config_.end()) && it->second.use_send_side_bwe; | 1369 (it != receive_rtp_config_.end()) && it->second.use_send_side_bwe; |
1375 | 1370 |
1376 RTPHeader header; | 1371 RTPHeader header; |
1377 packet.GetHeader(&header); | 1372 packet.GetHeader(&header); |
(...skipping 13 matching lines...) Expand all Loading... | |
1391 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { | 1386 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { |
1392 receive_side_cc_.OnReceivedPacket( | 1387 receive_side_cc_.OnReceivedPacket( |
1393 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), | 1388 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), |
1394 header); | 1389 header); |
1395 } | 1390 } |
1396 } | 1391 } |
1397 | 1392 |
1398 } // namespace internal | 1393 } // namespace internal |
1399 | 1394 |
1400 } // namespace webrtc | 1395 } // namespace webrtc |
OLD | NEW |