From 14a97f0a9148be18a66a435a5933441eb023bc82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Bostr=C3=B6m?= Date: Fri, 17 Apr 2015 15:14:01 +0200 Subject: [PATCH] Remove simulcast modules from ViEReceiver. Instead of maintaining two lists of simulcast modules, deliver RTCP packets to simulcast modules inside ViEChannel. BUG=1695 R=stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/48119004 Cr-Commit-Position: refs/heads/master@{#9027} --- webrtc/video_engine/vie_channel.cc | 16 ++++++++++------ webrtc/video_engine/vie_receiver.cc | 18 ------------------ webrtc/video_engine/vie_receiver.h | 3 --- 3 files changed, 10 insertions(+), 27 deletions(-) diff --git a/webrtc/video_engine/vie_channel.cc b/webrtc/video_engine/vie_channel.cc index 353dc12863..5068438446 100644 --- a/webrtc/video_engine/vie_channel.cc +++ b/webrtc/video_engine/vie_channel.cc @@ -509,9 +509,6 @@ int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec, rtp_rtcp->RegisterSendChannelRtpStatisticsCallback( rtp_rtcp_->GetSendChannelRtpStatisticsCallback()); } - // |RegisterSimulcastRtpRtcpModules| resets all old weak pointers and old - // modules can be deleted after this step. - vie_receiver_.RegisterSimulcastRtpRtcpModules(simulcast_rtp_rtcp_); } else { while (!simulcast_rtp_rtcp_.empty()) { RtpRtcp* rtp_rtcp = simulcast_rtp_rtcp_.back(); @@ -523,8 +520,6 @@ int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec, simulcast_rtp_rtcp_.pop_back(); removed_rtp_rtcp_.push_front(rtp_rtcp); } - // Clear any previous modules. - vie_receiver_.RegisterSimulcastRtpRtcpModules(simulcast_rtp_rtcp_); } // Don't log this error, no way to check in advance if this pl_type is @@ -1602,7 +1597,16 @@ int32_t ViEChannel::ReceivedRTCPPacket( return -1; } } - return vie_receiver_.ReceivedRTCPPacket(rtcp_packet, rtcp_packet_length); + int ret = vie_receiver_.ReceivedRTCPPacket(rtcp_packet, rtcp_packet_length); + if (ret != 0) + return ret; + + CriticalSectionScoped cs(rtp_rtcp_cs_.get()); + for (RtpRtcp* rtp_rtcp : simulcast_rtp_rtcp_) { + rtp_rtcp->IncomingRtcpPacket(static_cast(rtcp_packet), + rtcp_packet_length); + } + return 0; } int32_t ViEChannel::SetMTU(uint16_t mtu) { diff --git a/webrtc/video_engine/vie_receiver.cc b/webrtc/video_engine/vie_receiver.cc index e61c82bb9d..0265ee6cef 100644 --- a/webrtc/video_engine/vie_receiver.cc +++ b/webrtc/video_engine/vie_receiver.cc @@ -151,18 +151,6 @@ RtpReceiver* ViEReceiver::GetRtpReceiver() const { return rtp_receiver_.get(); } -void ViEReceiver::RegisterSimulcastRtpRtcpModules( - const std::list& rtp_modules) { - CriticalSectionScoped cs(receive_cs_.get()); - rtp_rtcp_simulcast_.clear(); - - if (!rtp_modules.empty()) { - rtp_rtcp_simulcast_.insert(rtp_rtcp_simulcast_.begin(), - rtp_modules.begin(), - rtp_modules.end()); - } -} - bool ViEReceiver::SetReceiveTimestampOffsetStatus(bool enable, int id) { if (enable) { return rtp_header_parser_->RegisterRtpHeaderExtension( @@ -419,12 +407,6 @@ int ViEReceiver::InsertRTCPPacket(const uint8_t* rtcp_packet, if (rtp_dump_) { rtp_dump_->DumpPacket(rtcp_packet, rtcp_packet_length); } - - std::list::iterator it = rtp_rtcp_simulcast_.begin(); - while (it != rtp_rtcp_simulcast_.end()) { - RtpRtcp* rtp_rtcp = *it++; - rtp_rtcp->IncomingRtcpPacket(rtcp_packet, rtcp_packet_length); - } } assert(rtp_rtcp_); // Should be set by owner at construction time. int ret = rtp_rtcp_->IncomingRtcpPacket(rtcp_packet, rtcp_packet_length); diff --git a/webrtc/video_engine/vie_receiver.h b/webrtc/video_engine/vie_receiver.h index 5c09a3e482..3cb8677446 100644 --- a/webrtc/video_engine/vie_receiver.h +++ b/webrtc/video_engine/vie_receiver.h @@ -60,8 +60,6 @@ class ViEReceiver : public RtpData { RtpReceiver* GetRtpReceiver() const; - void RegisterSimulcastRtpRtcpModules(const std::list& rtp_modules); - bool SetReceiveTimestampOffsetStatus(bool enable, int id); bool SetReceiveAbsoluteSendTimeStatus(bool enable, int id); bool SetReceiveVideoRotationStatus(bool enable, int id); @@ -113,7 +111,6 @@ class ViEReceiver : public RtpData { rtc::scoped_ptr rtp_receive_statistics_; rtc::scoped_ptr fec_receiver_; RtpRtcp* rtp_rtcp_; - std::list rtp_rtcp_simulcast_; VideoCodingModule* vcm_; RemoteBitrateEstimator* remote_bitrate_estimator_;