Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: webrtc/call/call.cc

Issue 2886993005: Introduce RtpStreamReceiver and RtpStreamReceiverControllerInterface. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_transport_controller_receive.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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // Audio, Video, and FlexFEC receive streams are owned by the client that 206 // Audio, Video, and FlexFEC receive streams are owned by the client that
207 // creates them. 207 // creates them.
208 std::set<AudioReceiveStream*> audio_receive_streams_ 208 std::set<AudioReceiveStream*> audio_receive_streams_
209 GUARDED_BY(receive_crit_); 209 GUARDED_BY(receive_crit_);
210 std::set<VideoReceiveStream*> video_receive_streams_ 210 std::set<VideoReceiveStream*> video_receive_streams_
211 GUARDED_BY(receive_crit_); 211 GUARDED_BY(receive_crit_);
212 212
213 std::map<std::string, AudioReceiveStream*> sync_stream_mapping_ 213 std::map<std::string, AudioReceiveStream*> sync_stream_mapping_
214 GUARDED_BY(receive_crit_); 214 GUARDED_BY(receive_crit_);
215 215
216 // TODO(nisse): Should eventually be part of injected 216 // TODO(nisse): Should eventually be injected at creation,
217 // RtpTransportControllerReceive, with a single demuxer in the bundled case. 217 // with a single object in the bundled case.
218 RtpDemuxer audio_rtp_demuxer_ GUARDED_BY(receive_crit_); 218 RtpTransportControllerReceive audio_transport_receive_
219 RtpDemuxer video_rtp_demuxer_ GUARDED_BY(receive_crit_); 219 GUARDED_BY(receive_crit_);
220 RtpTransportControllerReceive video_transport_receive_
221 GUARDED_BY(receive_crit_);
220 222
221 // This extra map is used for receive processing which is 223 // This extra map is used for receive processing which is
222 // independent of media type. 224 // independent of media type.
223 225
224 // TODO(nisse): In the RTP transport refactoring, we should have a 226 // TODO(nisse): In the RTP transport refactoring, we should have a
225 // single mapping from ssrc to a more abstract receive stream, with 227 // single mapping from ssrc to a more abstract receive stream, with
226 // accessor methods for all configuration we need at this level. 228 // accessor methods for all configuration we need at this level.
227 struct ReceiveRtpConfig { 229 struct ReceiveRtpConfig {
228 ReceiveRtpConfig() = default; // Needed by std::map 230 ReceiveRtpConfig() = default; // Needed by std::map
229 ReceiveRtpConfig(const std::vector<RtpExtension>& extensions, 231 ReceiveRtpConfig(const std::vector<RtpExtension>& extensions,
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 } 554 }
553 UpdateAggregateNetworkState(); 555 UpdateAggregateNetworkState();
554 delete audio_send_stream; 556 delete audio_send_stream;
555 } 557 }
556 558
557 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( 559 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream(
558 const webrtc::AudioReceiveStream::Config& config) { 560 const webrtc::AudioReceiveStream::Config& config) {
559 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); 561 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream");
560 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 562 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
561 event_log_->LogAudioReceiveStreamConfig(config); 563 event_log_->LogAudioReceiveStreamConfig(config);
562 AudioReceiveStream* receive_stream = 564 AudioReceiveStream* receive_stream;
563 new AudioReceiveStream(transport_send_->packet_router(), config,
564 config_.audio_state, event_log_);
565 { 565 {
566 WriteLockScoped write_lock(*receive_crit_); 566 WriteLockScoped write_lock(*receive_crit_);
567 audio_rtp_demuxer_.AddSink(config.rtp.remote_ssrc, receive_stream); 567 // Constructor is expected to register with audio_transport_receive_,
568 // and hence needs to be called while holding the lock.
569
570 // TODO(nisse): Make RtpTransportControllerReceive thread safe. But it's
571 // unfortunate if we need additional locks for each packet processed.
572 receive_stream = new AudioReceiveStream(
573 &audio_transport_receive_, transport_send_->packet_router(), config,
574 config_.audio_state, event_log_);
568 receive_rtp_config_[config.rtp.remote_ssrc] = 575 receive_rtp_config_[config.rtp.remote_ssrc] =
569 ReceiveRtpConfig(config.rtp.extensions, UseSendSideBwe(config)); 576 ReceiveRtpConfig(config.rtp.extensions, UseSendSideBwe(config));
570 audio_receive_streams_.insert(receive_stream); 577 audio_receive_streams_.insert(receive_stream);
571 578
572 ConfigureSync(config.sync_group); 579 ConfigureSync(config.sync_group);
573 } 580 }
574 { 581 {
575 ReadLockScoped read_lock(*send_crit_); 582 ReadLockScoped read_lock(*send_crit_);
576 auto it = audio_send_ssrcs_.find(config.rtp.local_ssrc); 583 auto it = audio_send_ssrcs_.find(config.rtp.local_ssrc);
577 if (it != audio_send_ssrcs_.end()) { 584 if (it != audio_send_ssrcs_.end()) {
(...skipping 11 matching lines...) Expand all
589 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 596 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
590 RTC_DCHECK(receive_stream != nullptr); 597 RTC_DCHECK(receive_stream != nullptr);
591 webrtc::internal::AudioReceiveStream* audio_receive_stream = 598 webrtc::internal::AudioReceiveStream* audio_receive_stream =
592 static_cast<webrtc::internal::AudioReceiveStream*>(receive_stream); 599 static_cast<webrtc::internal::AudioReceiveStream*>(receive_stream);
593 { 600 {
594 WriteLockScoped write_lock(*receive_crit_); 601 WriteLockScoped write_lock(*receive_crit_);
595 const AudioReceiveStream::Config& config = audio_receive_stream->config(); 602 const AudioReceiveStream::Config& config = audio_receive_stream->config();
596 uint32_t ssrc = config.rtp.remote_ssrc; 603 uint32_t ssrc = config.rtp.remote_ssrc;
597 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) 604 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config))
598 ->RemoveStream(ssrc); 605 ->RemoveStream(ssrc);
599 size_t num_deleted = audio_rtp_demuxer_.RemoveSink(audio_receive_stream);
600 RTC_DCHECK(num_deleted == 1);
601 audio_receive_streams_.erase(audio_receive_stream); 606 audio_receive_streams_.erase(audio_receive_stream);
602 const std::string& sync_group = audio_receive_stream->config().sync_group; 607 const std::string& sync_group = audio_receive_stream->config().sync_group;
603 const auto it = sync_stream_mapping_.find(sync_group); 608 const auto it = sync_stream_mapping_.find(sync_group);
604 if (it != sync_stream_mapping_.end() && 609 if (it != sync_stream_mapping_.end() &&
605 it->second == audio_receive_stream) { 610 it->second == audio_receive_stream) {
606 sync_stream_mapping_.erase(it); 611 sync_stream_mapping_.erase(it);
607 ConfigureSync(sync_group); 612 ConfigureSync(sync_group);
608 } 613 }
609 receive_rtp_config_.erase(ssrc); 614 receive_rtp_config_.erase(ssrc);
615 // Destructor is expected to register with audio_transport_receive_,
616 // and hence needs to be called while holding the lock.
617 delete audio_receive_stream;
610 } 618 }
611 UpdateAggregateNetworkState(); 619 UpdateAggregateNetworkState();
612 delete audio_receive_stream;
613 } 620 }
614 621
615 webrtc::VideoSendStream* Call::CreateVideoSendStream( 622 webrtc::VideoSendStream* Call::CreateVideoSendStream(
616 webrtc::VideoSendStream::Config config, 623 webrtc::VideoSendStream::Config config,
617 VideoEncoderConfig encoder_config) { 624 VideoEncoderConfig encoder_config) {
618 TRACE_EVENT0("webrtc", "Call::CreateVideoSendStream"); 625 TRACE_EVENT0("webrtc", "Call::CreateVideoSendStream");
619 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 626 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
620 627
621 video_send_delay_stats_->AddSsrcs(config); 628 video_send_delay_stats_->AddSsrcs(config);
622 event_log_->LogVideoSendStreamConfig(config); 629 event_log_->LogVideoSendStreamConfig(config);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 685
679 UpdateAggregateNetworkState(); 686 UpdateAggregateNetworkState();
680 delete send_stream_impl; 687 delete send_stream_impl;
681 } 688 }
682 689
683 webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream( 690 webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream(
684 webrtc::VideoReceiveStream::Config configuration) { 691 webrtc::VideoReceiveStream::Config configuration) {
685 TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream"); 692 TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream");
686 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 693 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
687 694
688 VideoReceiveStream* receive_stream = 695 VideoReceiveStream* receive_stream;
689 new VideoReceiveStream(num_cpu_cores_, transport_send_->packet_router(), 696 const webrtc::VideoReceiveStream::Config* config;
690 std::move(configuration),
691 module_process_thread_.get(), call_stats_.get());
692
693 const webrtc::VideoReceiveStream::Config& config = receive_stream->config();
694 ReceiveRtpConfig receive_config(config.rtp.extensions,
695 UseSendSideBwe(config));
696 { 697 {
697 WriteLockScoped write_lock(*receive_crit_); 698 WriteLockScoped write_lock(*receive_crit_);
698 video_rtp_demuxer_.AddSink(config.rtp.remote_ssrc, receive_stream); 699 // Constructor is expected to register with audio_transport_receive_,
699 if (config.rtp.rtx_ssrc) { 700 // and hence needs to be called while holding the lock.
700 video_rtp_demuxer_.AddSink(config.rtp.rtx_ssrc, receive_stream); 701 receive_stream = new VideoReceiveStream(
702 &video_transport_receive_, num_cpu_cores_,
703 transport_send_->packet_router(), std::move(configuration),
704 module_process_thread_.get(), call_stats_.get());
705
706 config = &receive_stream->config();
707 ReceiveRtpConfig receive_config(config->rtp.extensions,
708 UseSendSideBwe(*config));
709 if (config->rtp.rtx_ssrc) {
701 // We record identical config for the rtx stream as for the main 710 // We record identical config for the rtx stream as for the main
702 // stream. Since the transport_send_cc negotiation is per payload 711 // stream. Since the transport_send_cc negotiation is per payload
703 // type, we may get an incorrect value for the rtx stream, but 712 // type, we may get an incorrect value for the rtx stream, but
704 // that is unlikely to matter in practice. 713 // that is unlikely to matter in practice.
705 receive_rtp_config_[config.rtp.rtx_ssrc] = receive_config; 714 receive_rtp_config_[config->rtp.rtx_ssrc] = receive_config;
706 } 715 }
707 receive_rtp_config_[config.rtp.remote_ssrc] = receive_config; 716 receive_rtp_config_[config->rtp.remote_ssrc] = receive_config;
708 video_receive_streams_.insert(receive_stream); 717 video_receive_streams_.insert(receive_stream);
709 ConfigureSync(config.sync_group); 718 ConfigureSync(config->sync_group);
710 } 719 }
711 receive_stream->SignalNetworkState(video_network_state_); 720 receive_stream->SignalNetworkState(video_network_state_);
712 UpdateAggregateNetworkState(); 721 UpdateAggregateNetworkState();
713 event_log_->LogVideoReceiveStreamConfig(config); 722 event_log_->LogVideoReceiveStreamConfig(*config);
714 return receive_stream; 723 return receive_stream;
715 } 724 }
716 725
717 void Call::DestroyVideoReceiveStream( 726 void Call::DestroyVideoReceiveStream(
718 webrtc::VideoReceiveStream* receive_stream) { 727 webrtc::VideoReceiveStream* receive_stream) {
719 TRACE_EVENT0("webrtc", "Call::DestroyVideoReceiveStream"); 728 TRACE_EVENT0("webrtc", "Call::DestroyVideoReceiveStream");
720 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 729 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
721 RTC_DCHECK(receive_stream != nullptr); 730 RTC_DCHECK(receive_stream != nullptr);
722 VideoReceiveStream* receive_stream_impl = 731 VideoReceiveStream* receive_stream_impl =
723 static_cast<VideoReceiveStream*>(receive_stream); 732 static_cast<VideoReceiveStream*>(receive_stream);
724 const VideoReceiveStream::Config& config = receive_stream_impl->config(); 733 const VideoReceiveStream::Config& config = receive_stream_impl->config();
725 { 734 {
726 WriteLockScoped write_lock(*receive_crit_); 735 WriteLockScoped write_lock(*receive_crit_);
727 // Remove all ssrcs pointing to a receive stream. As RTX retransmits on a 736 // Remove all ssrcs pointing to a receive stream. As RTX retransmits on a
728 // separate SSRC there can be either one or two. 737 // separate SSRC there can be either one or two.
729 size_t num_deleted = video_rtp_demuxer_.RemoveSink(receive_stream_impl);
730 RTC_DCHECK_GE(num_deleted, 1);
731 receive_rtp_config_.erase(config.rtp.remote_ssrc); 738 receive_rtp_config_.erase(config.rtp.remote_ssrc);
732 if (config.rtp.rtx_ssrc) { 739 if (config.rtp.rtx_ssrc) {
733 receive_rtp_config_.erase(config.rtp.rtx_ssrc); 740 receive_rtp_config_.erase(config.rtp.rtx_ssrc);
734 } 741 }
735 video_receive_streams_.erase(receive_stream_impl); 742 video_receive_streams_.erase(receive_stream_impl);
736 ConfigureSync(config.sync_group); 743 ConfigureSync(config.sync_group);
744
745 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config))
746 ->RemoveStream(config.rtp.remote_ssrc);
747
748 // Destructor is expected to register with audio_transport_receive_,
749 // and hence needs to be called while holding the lock.
750 delete receive_stream_impl;
737 } 751 }
738
739 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config))
740 ->RemoveStream(config.rtp.remote_ssrc);
741
742 UpdateAggregateNetworkState(); 752 UpdateAggregateNetworkState();
743 delete receive_stream_impl;
744 } 753 }
745 754
746 FlexfecReceiveStream* Call::CreateFlexfecReceiveStream( 755 FlexfecReceiveStream* Call::CreateFlexfecReceiveStream(
747 const FlexfecReceiveStream::Config& config) { 756 const FlexfecReceiveStream::Config& config) {
748 TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream"); 757 TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream");
749 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 758 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
750 759
751 RecoveredPacketReceiver* recovered_packet_receiver = this; 760 RecoveredPacketReceiver* recovered_packet_receiver = this;
752 FlexfecReceiveStreamImpl* receive_stream = new FlexfecReceiveStreamImpl(
753 config, recovered_packet_receiver, call_stats_->rtcp_rtt_stats(),
754 module_process_thread_.get());
755 761
762 FlexfecReceiveStreamImpl* receive_stream;
756 { 763 {
757 WriteLockScoped write_lock(*receive_crit_); 764 WriteLockScoped write_lock(*receive_crit_);
758 video_rtp_demuxer_.AddSink(config.remote_ssrc, receive_stream); 765 // Constructor is expected to register with audio_transport_receive_,
759 766 // and hence needs to be called while holding the lock.
760 for (auto ssrc : config.protected_media_ssrcs) 767 receive_stream = new FlexfecReceiveStreamImpl(
761 video_rtp_demuxer_.AddSink(ssrc, receive_stream); 768 &video_transport_receive_, config, recovered_packet_receiver,
769 call_stats_->rtcp_rtt_stats(), module_process_thread_.get());
762 770
763 RTC_DCHECK(receive_rtp_config_.find(config.remote_ssrc) == 771 RTC_DCHECK(receive_rtp_config_.find(config.remote_ssrc) ==
764 receive_rtp_config_.end()); 772 receive_rtp_config_.end());
765 receive_rtp_config_[config.remote_ssrc] = 773 receive_rtp_config_[config.remote_ssrc] =
766 ReceiveRtpConfig(config.rtp_header_extensions, UseSendSideBwe(config)); 774 ReceiveRtpConfig(config.rtp_header_extensions, UseSendSideBwe(config));
767 } 775 }
768 776
769 // TODO(brandtr): Store config in RtcEventLog here. 777 // TODO(brandtr): Store config in RtcEventLog here.
770 778
771 return receive_stream; 779 return receive_stream;
(...skipping 11 matching lines...) Expand all
783 { 791 {
784 WriteLockScoped write_lock(*receive_crit_); 792 WriteLockScoped write_lock(*receive_crit_);
785 793
786 const FlexfecReceiveStream::Config& config = 794 const FlexfecReceiveStream::Config& config =
787 receive_stream_impl->GetConfig(); 795 receive_stream_impl->GetConfig();
788 uint32_t ssrc = config.remote_ssrc; 796 uint32_t ssrc = config.remote_ssrc;
789 receive_rtp_config_.erase(ssrc); 797 receive_rtp_config_.erase(ssrc);
790 798
791 // Remove all SSRCs pointing to the FlexfecReceiveStreamImpl to be 799 // Remove all SSRCs pointing to the FlexfecReceiveStreamImpl to be
792 // destroyed. 800 // destroyed.
793 video_rtp_demuxer_.RemoveSink(receive_stream_impl);
794 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) 801 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config))
795 ->RemoveStream(ssrc); 802 ->RemoveStream(ssrc);
803
804 // Destructor is expected to register with audio_transport_receive_,
805 // and hence needs to be called while holding the lock.
806 delete receive_stream_impl;
796 } 807 }
797
798 delete receive_stream_impl;
799 } 808 }
800 809
801 Call::Stats Call::GetStats() const { 810 Call::Stats Call::GetStats() const {
802 // TODO(solenberg): Some test cases in EndToEndTest use this from a different 811 // TODO(solenberg): Some test cases in EndToEndTest use this from a different
803 // thread. Re-enable once that is fixed. 812 // thread. Re-enable once that is fixed.
804 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 813 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
805 Stats stats; 814 Stats stats;
806 // Fetch available send/receive bitrates. 815 // Fetch available send/receive bitrates.
807 uint32_t send_bandwidth = 0; 816 uint32_t send_bandwidth = 0;
808 transport_send_->send_side_cc()->GetBitrateController()->AvailableBandwidth( 817 transport_send_->send_side_cc()->GetBitrateController()->AvailableBandwidth(
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 // on parsed_packet to the receive streams. 1164 // on parsed_packet to the receive streams.
1156 rtc::Optional<RtpPacketReceived> parsed_packet = 1165 rtc::Optional<RtpPacketReceived> parsed_packet =
1157 ParseRtpPacket(packet, length, &packet_time); 1166 ParseRtpPacket(packet, length, &packet_time);
1158 1167
1159 if (!parsed_packet) 1168 if (!parsed_packet)
1160 return DELIVERY_PACKET_ERROR; 1169 return DELIVERY_PACKET_ERROR;
1161 1170
1162 NotifyBweOfReceivedPacket(*parsed_packet, media_type); 1171 NotifyBweOfReceivedPacket(*parsed_packet, media_type);
1163 1172
1164 if (media_type == MediaType::AUDIO) { 1173 if (media_type == MediaType::AUDIO) {
1165 if (audio_rtp_demuxer_.OnRtpPacket(*parsed_packet)) { 1174 if (audio_transport_receive_.OnRtpPacket(*parsed_packet)) {
1166 received_bytes_per_second_counter_.Add(static_cast<int>(length)); 1175 received_bytes_per_second_counter_.Add(static_cast<int>(length));
1167 received_audio_bytes_per_second_counter_.Add(static_cast<int>(length)); 1176 received_audio_bytes_per_second_counter_.Add(static_cast<int>(length));
1168 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); 1177 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length);
1169 return DELIVERY_OK; 1178 return DELIVERY_OK;
1170 } 1179 }
1171 } else if (media_type == MediaType::VIDEO) { 1180 } else if (media_type == MediaType::VIDEO) {
1172 if (video_rtp_demuxer_.OnRtpPacket(*parsed_packet)) { 1181 if (video_transport_receive_.OnRtpPacket(*parsed_packet)) {
1173 received_bytes_per_second_counter_.Add(static_cast<int>(length)); 1182 received_bytes_per_second_counter_.Add(static_cast<int>(length));
1174 received_video_bytes_per_second_counter_.Add(static_cast<int>(length)); 1183 received_video_bytes_per_second_counter_.Add(static_cast<int>(length));
1175 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); 1184 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length);
1176 return DELIVERY_OK; 1185 return DELIVERY_OK;
1177 } 1186 }
1178 } 1187 }
1179 return DELIVERY_UNKNOWN_SSRC; 1188 return DELIVERY_UNKNOWN_SSRC;
1180 } 1189 }
1181 1190
1182 PacketReceiver::DeliveryStatus Call::DeliverPacket( 1191 PacketReceiver::DeliveryStatus Call::DeliverPacket(
(...skipping 15 matching lines...) Expand all
1198 // audio packets with FlexFEC. 1207 // audio packets with FlexFEC.
1199 void Call::OnRecoveredPacket(const uint8_t* packet, size_t length) { 1208 void Call::OnRecoveredPacket(const uint8_t* packet, size_t length) {
1200 ReadLockScoped read_lock(*receive_crit_); 1209 ReadLockScoped read_lock(*receive_crit_);
1201 rtc::Optional<RtpPacketReceived> parsed_packet = 1210 rtc::Optional<RtpPacketReceived> parsed_packet =
1202 ParseRtpPacket(packet, length, nullptr); 1211 ParseRtpPacket(packet, length, nullptr);
1203 if (!parsed_packet) 1212 if (!parsed_packet)
1204 return; 1213 return;
1205 1214
1206 parsed_packet->set_recovered(true); 1215 parsed_packet->set_recovered(true);
1207 1216
1208 video_rtp_demuxer_.OnRtpPacket(*parsed_packet); 1217 video_transport_receive_.OnRtpPacket(*parsed_packet);
pthatcher1 2017/05/17 23:24:53 What is the advantage of working with the wrapper
nisse-webrtc 2017/05/18 08:45:43 At the moment, little. Responsibility for parsing
danilchap 2017/05/19 15:37:43 using ReceiverController feels preliminary: it sho
nisse-webrtc 2017/05/22 07:09:37 Agreed. I think we should aim to move all per-pack
1209 } 1218 }
1210 1219
1211 void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, 1220 void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet,
1212 MediaType media_type) { 1221 MediaType media_type) {
1213 auto it = receive_rtp_config_.find(packet.Ssrc()); 1222 auto it = receive_rtp_config_.find(packet.Ssrc());
1214 bool use_send_side_bwe = 1223 bool use_send_side_bwe =
1215 (it != receive_rtp_config_.end()) && it->second.use_send_side_bwe; 1224 (it != receive_rtp_config_.end()) && it->second.use_send_side_bwe;
1216 1225
1217 RTPHeader header; 1226 RTPHeader header;
1218 packet.GetHeader(&header); 1227 packet.GetHeader(&header);
(...skipping 13 matching lines...) Expand all
1232 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { 1241 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) {
1233 receive_side_cc_.OnReceivedPacket( 1242 receive_side_cc_.OnReceivedPacket(
1234 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), 1243 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(),
1235 header); 1244 header);
1236 } 1245 }
1237 } 1246 }
1238 1247
1239 } // namespace internal 1248 } // namespace internal
1240 1249
1241 } // namespace webrtc 1250 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698