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

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

Issue 2669463006: Move RemoteBitrateEstimator::RemoveStream calls from receive streams to Call. (Closed)
Patch Set: Rebase. Created 3 years, 10 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
« no previous file with comments | « webrtc/audio/audio_receive_stream_unittest.cc ('k') | webrtc/video/rtp_stream_receiver.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "webrtc/video/send_delay_stats.h" 53 #include "webrtc/video/send_delay_stats.h"
54 #include "webrtc/video/stats_counter.h" 54 #include "webrtc/video/stats_counter.h"
55 #include "webrtc/video/video_receive_stream.h" 55 #include "webrtc/video/video_receive_stream.h"
56 #include "webrtc/video/video_send_stream.h" 56 #include "webrtc/video/video_send_stream.h"
57 #include "webrtc/video/vie_remb.h" 57 #include "webrtc/video/vie_remb.h"
58 58
59 namespace webrtc { 59 namespace webrtc {
60 60
61 const int Call::Config::kDefaultStartBitrateBps = 300000; 61 const int Call::Config::kDefaultStartBitrateBps = 300000;
62 62
63 namespace {
64
65 // TODO(nisse): This really begs for a shared context struct.
66 bool UseSendSideBwe(const std::vector<RtpExtension>& extensions,
67 bool transport_cc) {
68 if (!transport_cc)
69 return false;
70 for (const auto& extension : extensions) {
71 if (extension.uri == RtpExtension::kTransportSequenceNumberUri)
72 return true;
73 }
74 return false;
75 }
76
77 bool UseSendSideBwe(const VideoReceiveStream::Config& config) {
78 return UseSendSideBwe(config.rtp.extensions, config.rtp.transport_cc);
79 }
80
81 bool UseSendSideBwe(const AudioReceiveStream::Config& config) {
82 return UseSendSideBwe(config.rtp.extensions, config.rtp.transport_cc);
83 }
84
85 bool UseSendSideBwe(const FlexfecReceiveStream::Config& config) {
86 return UseSendSideBwe(config.rtp_header_extensions, config.transport_cc);
87 }
88
89 } // namespace
90
63 namespace internal { 91 namespace internal {
64 92
65 class Call : public webrtc::Call, 93 class Call : public webrtc::Call,
66 public PacketReceiver, 94 public PacketReceiver,
67 public RecoveredPacketReceiver, 95 public RecoveredPacketReceiver,
68 public CongestionController::Observer, 96 public CongestionController::Observer,
69 public BitrateAllocator::LimitObserver { 97 public BitrateAllocator::LimitObserver {
70 public: 98 public:
71 explicit Call(const Call::Config& config); 99 explicit Call(const Call::Config& config);
72 virtual ~Call(); 100 virtual ~Call();
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 220
193 // This extra map is used for receive processing which is 221 // This extra map is used for receive processing which is
194 // independent of media type. 222 // independent of media type.
195 223
196 // TODO(nisse): In the RTP transport refactoring, we should have a 224 // TODO(nisse): In the RTP transport refactoring, we should have a
197 // single mapping from ssrc to a more abstract receive stream, with 225 // single mapping from ssrc to a more abstract receive stream, with
198 // accessor methods for all configuration we need at this level. 226 // accessor methods for all configuration we need at this level.
199 struct ReceiveRtpConfig { 227 struct ReceiveRtpConfig {
200 ReceiveRtpConfig() = default; // Needed by std::map 228 ReceiveRtpConfig() = default; // Needed by std::map
201 ReceiveRtpConfig(const std::vector<RtpExtension>& extensions, 229 ReceiveRtpConfig(const std::vector<RtpExtension>& extensions,
202 bool transport_cc) 230 bool use_send_side_bwe)
203 : extensions(extensions), transport_cc(transport_cc) {} 231 : extensions(extensions), use_send_side_bwe(use_send_side_bwe) {}
204 232
205 // Registered RTP header extensions for each stream. Note that RTP header 233 // Registered RTP header extensions for each stream. Note that RTP header
206 // extensions are negotiated per track ("m= line") in the SDP, but we have 234 // extensions are negotiated per track ("m= line") in the SDP, but we have
207 // no notion of tracks at the Call level. We therefore store the RTP header 235 // no notion of tracks at the Call level. We therefore store the RTP header
208 // extensions per SSRC instead, which leads to some storage overhead. 236 // extensions per SSRC instead, which leads to some storage overhead.
209 RtpHeaderExtensionMap extensions; 237 RtpHeaderExtensionMap extensions;
210 // Set if the RTCP feedback message needed for send side BWE was negotiated. 238 // Set if both RTP extension the RTCP feedback message needed for
211 bool transport_cc = false; 239 // send side BWE are negotiated.
240 bool use_send_side_bwe = false;
212 }; 241 };
213 std::map<uint32_t, ReceiveRtpConfig> receive_rtp_config_ 242 std::map<uint32_t, ReceiveRtpConfig> receive_rtp_config_
214 GUARDED_BY(receive_crit_); 243 GUARDED_BY(receive_crit_);
215 244
216 std::unique_ptr<RWLockWrapper> send_crit_; 245 std::unique_ptr<RWLockWrapper> send_crit_;
217 // Audio and Video send streams are owned by the client that creates them. 246 // Audio and Video send streams are owned by the client that creates them.
218 std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_); 247 std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_);
219 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_); 248 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_);
220 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_); 249 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_);
221 250
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 UpdateAggregateNetworkState(); 547 UpdateAggregateNetworkState();
519 delete audio_send_stream; 548 delete audio_send_stream;
520 } 549 }
521 550
522 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( 551 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream(
523 const webrtc::AudioReceiveStream::Config& config) { 552 const webrtc::AudioReceiveStream::Config& config) {
524 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); 553 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream");
525 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 554 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
526 event_log_->LogAudioReceiveStreamConfig(config); 555 event_log_->LogAudioReceiveStreamConfig(config);
527 AudioReceiveStream* receive_stream = new AudioReceiveStream( 556 AudioReceiveStream* receive_stream = new AudioReceiveStream(
528 &packet_router_, 557 &packet_router_, config,
529 congestion_controller_->GetRemoteBitrateEstimator(true), config,
530 config_.audio_state, event_log_); 558 config_.audio_state, event_log_);
531 { 559 {
532 WriteLockScoped write_lock(*receive_crit_); 560 WriteLockScoped write_lock(*receive_crit_);
533 RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) == 561 RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) ==
534 audio_receive_ssrcs_.end()); 562 audio_receive_ssrcs_.end());
535 audio_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; 563 audio_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream;
536 receive_rtp_config_[config.rtp.remote_ssrc] = 564 receive_rtp_config_[config.rtp.remote_ssrc] =
537 ReceiveRtpConfig(config.rtp.extensions, config.rtp.transport_cc); 565 ReceiveRtpConfig(config.rtp.extensions, UseSendSideBwe(config));
538 566
539 ConfigureSync(config.sync_group); 567 ConfigureSync(config.sync_group);
540 } 568 }
541 { 569 {
542 ReadLockScoped read_lock(*send_crit_); 570 ReadLockScoped read_lock(*send_crit_);
543 auto it = audio_send_ssrcs_.find(config.rtp.local_ssrc); 571 auto it = audio_send_ssrcs_.find(config.rtp.local_ssrc);
544 if (it != audio_send_ssrcs_.end()) { 572 if (it != audio_send_ssrcs_.end()) {
545 receive_stream->AssociateSendStream(it->second); 573 receive_stream->AssociateSendStream(it->second);
546 } 574 }
547 } 575 }
548 receive_stream->SignalNetworkState(audio_network_state_); 576 receive_stream->SignalNetworkState(audio_network_state_);
549 UpdateAggregateNetworkState(); 577 UpdateAggregateNetworkState();
550 return receive_stream; 578 return receive_stream;
551 } 579 }
552 580
553 void Call::DestroyAudioReceiveStream( 581 void Call::DestroyAudioReceiveStream(
554 webrtc::AudioReceiveStream* receive_stream) { 582 webrtc::AudioReceiveStream* receive_stream) {
555 TRACE_EVENT0("webrtc", "Call::DestroyAudioReceiveStream"); 583 TRACE_EVENT0("webrtc", "Call::DestroyAudioReceiveStream");
556 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 584 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
557 RTC_DCHECK(receive_stream != nullptr); 585 RTC_DCHECK(receive_stream != nullptr);
558 webrtc::internal::AudioReceiveStream* audio_receive_stream = 586 webrtc::internal::AudioReceiveStream* audio_receive_stream =
559 static_cast<webrtc::internal::AudioReceiveStream*>(receive_stream); 587 static_cast<webrtc::internal::AudioReceiveStream*>(receive_stream);
560 { 588 {
561 WriteLockScoped write_lock(*receive_crit_); 589 WriteLockScoped write_lock(*receive_crit_);
562 uint32_t ssrc = audio_receive_stream->config().rtp.remote_ssrc; 590 const AudioReceiveStream::Config& config = audio_receive_stream->config();
563 591 uint32_t ssrc = config.rtp.remote_ssrc;
592 congestion_controller_->GetRemoteBitrateEstimator(UseSendSideBwe(config))
593 ->RemoveStream(ssrc);
564 size_t num_deleted = audio_receive_ssrcs_.erase(ssrc); 594 size_t num_deleted = audio_receive_ssrcs_.erase(ssrc);
565 RTC_DCHECK(num_deleted == 1); 595 RTC_DCHECK(num_deleted == 1);
566 const std::string& sync_group = audio_receive_stream->config().sync_group; 596 const std::string& sync_group = audio_receive_stream->config().sync_group;
567 const auto it = sync_stream_mapping_.find(sync_group); 597 const auto it = sync_stream_mapping_.find(sync_group);
568 if (it != sync_stream_mapping_.end() && 598 if (it != sync_stream_mapping_.end() &&
569 it->second == audio_receive_stream) { 599 it->second == audio_receive_stream) {
570 sync_stream_mapping_.erase(it); 600 sync_stream_mapping_.erase(it);
571 ConfigureSync(sync_group); 601 ConfigureSync(sync_group);
572 } 602 }
573 receive_rtp_config_.erase(ssrc); 603 receive_rtp_config_.erase(ssrc);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 681 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
652 682
653 bool protected_by_flexfec = false; 683 bool protected_by_flexfec = false;
654 { 684 {
655 ReadLockScoped read_lock(*receive_crit_); 685 ReadLockScoped read_lock(*receive_crit_);
656 protected_by_flexfec = 686 protected_by_flexfec =
657 flexfec_receive_ssrcs_media_.find(configuration.rtp.remote_ssrc) != 687 flexfec_receive_ssrcs_media_.find(configuration.rtp.remote_ssrc) !=
658 flexfec_receive_ssrcs_media_.end(); 688 flexfec_receive_ssrcs_media_.end();
659 } 689 }
660 VideoReceiveStream* receive_stream = new VideoReceiveStream( 690 VideoReceiveStream* receive_stream = new VideoReceiveStream(
661 num_cpu_cores_, protected_by_flexfec, congestion_controller_.get(), 691 num_cpu_cores_, protected_by_flexfec,
662 &packet_router_, std::move(configuration), module_process_thread_.get(), 692 &packet_router_, std::move(configuration), module_process_thread_.get(),
663 call_stats_.get(), &remb_); 693 call_stats_.get(), &remb_);
664 694
665 const webrtc::VideoReceiveStream::Config& config = receive_stream->config(); 695 const webrtc::VideoReceiveStream::Config& config = receive_stream->config();
666 ReceiveRtpConfig receive_config(config.rtp.extensions, 696 ReceiveRtpConfig receive_config(config.rtp.extensions,
667 config.rtp.transport_cc); 697 UseSendSideBwe(config));
668 { 698 {
669 WriteLockScoped write_lock(*receive_crit_); 699 WriteLockScoped write_lock(*receive_crit_);
670 RTC_DCHECK(video_receive_ssrcs_.find(config.rtp.remote_ssrc) == 700 RTC_DCHECK(video_receive_ssrcs_.find(config.rtp.remote_ssrc) ==
671 video_receive_ssrcs_.end()); 701 video_receive_ssrcs_.end());
672 video_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; 702 video_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream;
673 if (config.rtp.rtx_ssrc) { 703 if (config.rtp.rtx_ssrc) {
674 video_receive_ssrcs_[config.rtp.rtx_ssrc] = receive_stream; 704 video_receive_ssrcs_[config.rtp.rtx_ssrc] = receive_stream;
675 // We record identical config for the rtx stream as for the main 705 // We record identical config for the rtx stream as for the main
676 // stream. Since the transport_cc negotiation is per payload 706 // stream. Since the transport_cc negotiation is per payload
677 // type, we may get an incorrect value for the rtx stream, but 707 // type, we may get an incorrect value for the rtx stream, but
(...skipping 29 matching lines...) Expand all
707 receive_rtp_config_.erase(it->first); 737 receive_rtp_config_.erase(it->first);
708 it = video_receive_ssrcs_.erase(it); 738 it = video_receive_ssrcs_.erase(it);
709 } else { 739 } else {
710 ++it; 740 ++it;
711 } 741 }
712 } 742 }
713 video_receive_streams_.erase(receive_stream_impl); 743 video_receive_streams_.erase(receive_stream_impl);
714 RTC_CHECK(receive_stream_impl != nullptr); 744 RTC_CHECK(receive_stream_impl != nullptr);
715 ConfigureSync(receive_stream_impl->config().sync_group); 745 ConfigureSync(receive_stream_impl->config().sync_group);
716 } 746 }
747 const VideoReceiveStream::Config& config = receive_stream_impl->config();
748
749 congestion_controller_->GetRemoteBitrateEstimator(UseSendSideBwe(config))
750 ->RemoveStream(config.rtp.remote_ssrc);
751
717 UpdateAggregateNetworkState(); 752 UpdateAggregateNetworkState();
718 delete receive_stream_impl; 753 delete receive_stream_impl;
719 } 754 }
720 755
721 FlexfecReceiveStream* Call::CreateFlexfecReceiveStream( 756 FlexfecReceiveStream* Call::CreateFlexfecReceiveStream(
722 const FlexfecReceiveStream::Config& config) { 757 const FlexfecReceiveStream::Config& config) {
723 TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream"); 758 TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream");
724 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 759 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
725 760
726 RecoveredPacketReceiver* recovered_packet_receiver = this; 761 RecoveredPacketReceiver* recovered_packet_receiver = this;
(...skipping 11 matching lines...) Expand all
738 for (auto ssrc : config.protected_media_ssrcs) 773 for (auto ssrc : config.protected_media_ssrcs)
739 flexfec_receive_ssrcs_media_.insert(std::make_pair(ssrc, receive_stream)); 774 flexfec_receive_ssrcs_media_.insert(std::make_pair(ssrc, receive_stream));
740 775
741 RTC_DCHECK(flexfec_receive_ssrcs_protection_.find(config.remote_ssrc) == 776 RTC_DCHECK(flexfec_receive_ssrcs_protection_.find(config.remote_ssrc) ==
742 flexfec_receive_ssrcs_protection_.end()); 777 flexfec_receive_ssrcs_protection_.end());
743 flexfec_receive_ssrcs_protection_[config.remote_ssrc] = receive_stream; 778 flexfec_receive_ssrcs_protection_[config.remote_ssrc] = receive_stream;
744 779
745 RTC_DCHECK(receive_rtp_config_.find(config.remote_ssrc) == 780 RTC_DCHECK(receive_rtp_config_.find(config.remote_ssrc) ==
746 receive_rtp_config_.end()); 781 receive_rtp_config_.end());
747 receive_rtp_config_[config.remote_ssrc] = 782 receive_rtp_config_[config.remote_ssrc] =
748 ReceiveRtpConfig(config.rtp_header_extensions, config.transport_cc); 783 ReceiveRtpConfig(config.rtp_header_extensions, UseSendSideBwe(config));
749 } 784 }
750 785
751 // TODO(brandtr): Store config in RtcEventLog here. 786 // TODO(brandtr): Store config in RtcEventLog here.
752 787
753 return receive_stream; 788 return receive_stream;
754 } 789 }
755 790
756 void Call::DestroyFlexfecReceiveStream(FlexfecReceiveStream* receive_stream) { 791 void Call::DestroyFlexfecReceiveStream(FlexfecReceiveStream* receive_stream) {
757 TRACE_EVENT0("webrtc", "Call::DestroyFlexfecReceiveStream"); 792 TRACE_EVENT0("webrtc", "Call::DestroyFlexfecReceiveStream");
758 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 793 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
759 794
760 RTC_DCHECK(receive_stream != nullptr); 795 RTC_DCHECK(receive_stream != nullptr);
761 // There exist no other derived classes of FlexfecReceiveStream, 796 // There exist no other derived classes of FlexfecReceiveStream,
762 // so this downcast is safe. 797 // so this downcast is safe.
763 FlexfecReceiveStreamImpl* receive_stream_impl = 798 FlexfecReceiveStreamImpl* receive_stream_impl =
764 static_cast<FlexfecReceiveStreamImpl*>(receive_stream); 799 static_cast<FlexfecReceiveStreamImpl*>(receive_stream);
765 { 800 {
766 WriteLockScoped write_lock(*receive_crit_); 801 WriteLockScoped write_lock(*receive_crit_);
767 802
768 uint32_t ssrc = receive_stream_impl->GetConfig().remote_ssrc; 803 const FlexfecReceiveStream::Config& config =
804 receive_stream_impl->GetConfig();
805 uint32_t ssrc = config.remote_ssrc;
769 receive_rtp_config_.erase(ssrc); 806 receive_rtp_config_.erase(ssrc);
770 807
771 // Remove all SSRCs pointing to the FlexfecReceiveStreamImpl to be 808 // Remove all SSRCs pointing to the FlexfecReceiveStreamImpl to be
772 // destroyed. 809 // destroyed.
773 auto prot_it = flexfec_receive_ssrcs_protection_.begin(); 810 auto prot_it = flexfec_receive_ssrcs_protection_.begin();
774 while (prot_it != flexfec_receive_ssrcs_protection_.end()) { 811 while (prot_it != flexfec_receive_ssrcs_protection_.end()) {
775 if (prot_it->second == receive_stream_impl) 812 if (prot_it->second == receive_stream_impl)
776 prot_it = flexfec_receive_ssrcs_protection_.erase(prot_it); 813 prot_it = flexfec_receive_ssrcs_protection_.erase(prot_it);
777 else 814 else
778 ++prot_it; 815 ++prot_it;
779 } 816 }
780 auto media_it = flexfec_receive_ssrcs_media_.begin(); 817 auto media_it = flexfec_receive_ssrcs_media_.begin();
781 while (media_it != flexfec_receive_ssrcs_media_.end()) { 818 while (media_it != flexfec_receive_ssrcs_media_.end()) {
782 if (media_it->second == receive_stream_impl) 819 if (media_it->second == receive_stream_impl)
783 media_it = flexfec_receive_ssrcs_media_.erase(media_it); 820 media_it = flexfec_receive_ssrcs_media_.erase(media_it);
784 else 821 else
785 ++media_it; 822 ++media_it;
786 } 823 }
787 824
825 congestion_controller_->GetRemoteBitrateEstimator(UseSendSideBwe(config))
826 ->RemoveStream(ssrc);
827
788 flexfec_receive_streams_.erase(receive_stream_impl); 828 flexfec_receive_streams_.erase(receive_stream_impl);
789 } 829 }
790 830
791 delete receive_stream_impl; 831 delete receive_stream_impl;
792 } 832 }
793 833
794 Call::Stats Call::GetStats() const { 834 Call::Stats Call::GetStats() const {
795 // TODO(solenberg): Some test cases in EndToEndTest use this from a different 835 // TODO(solenberg): Some test cases in EndToEndTest use this from a different
796 // thread. Re-enable once that is fixed. 836 // thread. Re-enable once that is fixed.
797 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 837 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 ReadLockScoped read_lock(*receive_crit_); 1267 ReadLockScoped read_lock(*receive_crit_);
1228 auto it = video_receive_ssrcs_.find(ssrc); 1268 auto it = video_receive_ssrcs_.find(ssrc);
1229 if (it == video_receive_ssrcs_.end()) 1269 if (it == video_receive_ssrcs_.end())
1230 return false; 1270 return false;
1231 return it->second->OnRecoveredPacket(packet, length); 1271 return it->second->OnRecoveredPacket(packet, length);
1232 } 1272 }
1233 1273
1234 void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, 1274 void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet,
1235 MediaType media_type) { 1275 MediaType media_type) {
1236 auto it = receive_rtp_config_.find(packet.Ssrc()); 1276 auto it = receive_rtp_config_.find(packet.Ssrc());
1237 bool transport_cc = 1277 bool use_send_side_bwe =
1238 (it != receive_rtp_config_.end()) && it->second.transport_cc; 1278 (it != receive_rtp_config_.end()) && it->second.use_send_side_bwe;
1239 1279
1240 RTPHeader header; 1280 RTPHeader header;
1241 packet.GetHeader(&header); 1281 packet.GetHeader(&header);
1242 1282
1243 if (!transport_cc && header.extension.hasTransportSequenceNumber) { 1283 if (!use_send_side_bwe && header.extension.hasTransportSequenceNumber) {
1244 // Inconsistent configuration of send side BWE. Do nothing. 1284 // Inconsistent configuration of send side BWE. Do nothing.
1245 // TODO(nisse): Without this check, we may produce RTCP feedback 1285 // TODO(nisse): Without this check, we may produce RTCP feedback
1246 // packets even when not negotiated. But it would be cleaner to 1286 // packets even when not negotiated. But it would be cleaner to
1247 // move the check down to RTCPSender::SendFeedbackPacket, which 1287 // move the check down to RTCPSender::SendFeedbackPacket, which
1248 // would also help the PacketRouter to select an appropriate rtp 1288 // would also help the PacketRouter to select an appropriate rtp
1249 // module in the case that some, but not all, have RTCP feedback 1289 // module in the case that some, but not all, have RTCP feedback
1250 // enabled. 1290 // enabled.
1251 return; 1291 return;
1252 } 1292 }
1253 // For audio, we only support send side BWE. 1293 // For audio, we only support send side BWE.
1254 // TODO(nisse): Tests passes MediaType::ANY, see 1294 // TODO(nisse): Tests passes MediaType::ANY, see
1255 // FakeNetworkPipe::Process. We need to treat that as video. Tests 1295 // FakeNetworkPipe::Process. We need to treat that as video. Tests
1256 // should be fixed to use the same MediaType as the production code. 1296 // should be fixed to use the same MediaType as the production code.
1257 if (media_type != MediaType::AUDIO || 1297 if (media_type != MediaType::AUDIO ||
1258 (transport_cc && header.extension.hasTransportSequenceNumber)) { 1298 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) {
1259 congestion_controller_->OnReceivedPacket( 1299 congestion_controller_->OnReceivedPacket(
1260 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), 1300 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(),
1261 header); 1301 header);
1262 } 1302 }
1263 } 1303 }
1264 1304
1265 } // namespace internal 1305 } // namespace internal
1266 } // namespace webrtc 1306 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/audio/audio_receive_stream_unittest.cc ('k') | webrtc/video/rtp_stream_receiver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698