diff --git a/audio/channel.cc b/audio/channel.cc index 7dd04d696e..a7325c32a9 100644 --- a/audio/channel.cc +++ b/audio/channel.cc @@ -362,10 +362,6 @@ void Channel::OnIncomingSSRCChanged(uint32_t ssrc) { _rtpRtcpModule->SetRemoteSSRC(ssrc); } -void Channel::OnIncomingCSRCChanged(uint32_t CSRC, bool added) { - // TODO(saza): remove. -} - int32_t Channel::OnReceivedPayloadData(const uint8_t* payloadData, size_t payloadSize, const WebRtcRTPHeader* rtpHeader) { diff --git a/audio/channel.h b/audio/channel.h index dbb670aa85..ab25aad0ca 100644 --- a/audio/channel.h +++ b/audio/channel.h @@ -250,7 +250,6 @@ class Channel // From RtpFeedback in the RTP/RTCP module void OnIncomingSSRCChanged(uint32_t ssrc) override; - void OnIncomingCSRCChanged(uint32_t CSRC, bool added) override; // From Transport (called by the RTP/RTCP module) bool SendRtp(const uint8_t* data, diff --git a/modules/rtp_rtcp/include/rtp_rtcp_defines.h b/modules/rtp_rtcp/include/rtp_rtcp_defines.h index f66ebb3cc4..28ee47b5b5 100644 --- a/modules/rtp_rtcp/include/rtp_rtcp_defines.h +++ b/modules/rtp_rtcp/include/rtp_rtcp_defines.h @@ -257,8 +257,6 @@ class RtpFeedback { virtual ~RtpFeedback() {} virtual void OnIncomingSSRCChanged(uint32_t ssrc) = 0; - - virtual void OnIncomingCSRCChanged(uint32_t csrc, bool added) = 0; }; class RtcpIntraFrameObserver { @@ -443,7 +441,6 @@ class NullRtpFeedback : public RtpFeedback { ~NullRtpFeedback() override {} void OnIncomingSSRCChanged(uint32_t ssrc) override {} - void OnIncomingCSRCChanged(uint32_t csrc, bool added) override {} }; // Statistics about packet loss for a single directional connection. All values diff --git a/modules/rtp_rtcp/source/rtp_receiver_audio.cc b/modules/rtp_rtcp/source/rtp_receiver_audio.cc index 26410ae4dc..e3bbdd5e7b 100644 --- a/modules/rtp_rtcp/source/rtp_receiver_audio.cc +++ b/modules/rtp_rtcp/source/rtp_receiver_audio.cc @@ -71,11 +71,6 @@ bool RTPReceiverAudio::CNGPayloadType(int8_t payload_type) { payload_type == cng_fb_payload_type_; } -bool RTPReceiverAudio::ShouldReportCsrcChanges(uint8_t payload_type) const { - // Don't do this for DTMF packets, otherwise it's fine. - return !TelephoneEventPayloadType(payload_type); -} - // - Sample based or frame based codecs based on RFC 3551 // - // - NOTE! There is one error in the RFC, stating G.722 uses 8 bits/samples. diff --git a/modules/rtp_rtcp/source/rtp_receiver_audio.h b/modules/rtp_rtcp/source/rtp_receiver_audio.h index 6e6cfc1496..ded9d42426 100644 --- a/modules/rtp_rtcp/source/rtp_receiver_audio.h +++ b/modules/rtp_rtcp/source/rtp_receiver_audio.h @@ -52,8 +52,6 @@ class RTPReceiverAudio : public RTPReceiverStrategy, RTPAliveType ProcessDeadOrAlive(uint16_t last_payload_length) const override; - bool ShouldReportCsrcChanges(uint8_t payload_type) const override; - int32_t OnNewPayloadTypeCreated(int payload_type, const SdpAudioFormat& audio_format) override; diff --git a/modules/rtp_rtcp/source/rtp_receiver_impl.cc b/modules/rtp_rtcp/source/rtp_receiver_impl.cc index 1fd45bd3ff..60056c81fd 100644 --- a/modules/rtp_rtcp/source/rtp_receiver_impl.cc +++ b/modules/rtp_rtcp/source/rtp_receiver_impl.cc @@ -102,11 +102,7 @@ RtpReceiverImpl::RtpReceiverImpl(Clock* clock, memset(current_remote_csrc_, 0, sizeof(current_remote_csrc_)); } -RtpReceiverImpl::~RtpReceiverImpl() { - for (int i = 0; i < num_csrcs_; ++i) { - cb_rtp_feedback_->OnIncomingCSRCChanged(current_remote_csrc_[i], false); - } -} +RtpReceiverImpl::~RtpReceiverImpl() {} int32_t RtpReceiverImpl::RegisterReceivePayload( int payload_type, @@ -342,84 +338,21 @@ int32_t RtpReceiverImpl::CheckPayloadChanged(const RTPHeader& rtp_header, // Implementation note: must not hold critsect when called. void RtpReceiverImpl::CheckCSRC(const WebRtcRTPHeader& rtp_header) { - int32_t num_csrcs_diff = 0; - uint32_t old_remote_csrc[kRtpCsrcSize]; - uint8_t old_num_csrcs = 0; - + const uint8_t num_csrcs = rtp_header.header.numCSRCs; + if (num_csrcs > kRtpCsrcSize) { + // Ignore. + return; + } { rtc::CritScope lock(&critical_section_rtp_receiver_); - if (!rtp_media_receiver_->ShouldReportCsrcChanges( - rtp_header.header.payloadType)) { - return; - } - old_num_csrcs = num_csrcs_; - if (old_num_csrcs > 0) { - // Make a copy of old. - memcpy(old_remote_csrc, current_remote_csrc_, - num_csrcs_ * sizeof(uint32_t)); - } - const uint8_t num_csrcs = rtp_header.header.numCSRCs; - if ((num_csrcs > 0) && (num_csrcs <= kRtpCsrcSize)) { - // Copy new. - memcpy(current_remote_csrc_, - rtp_header.header.arrOfCSRCs, - num_csrcs * sizeof(uint32_t)); - } - if (num_csrcs > 0 || old_num_csrcs > 0) { - num_csrcs_diff = num_csrcs - old_num_csrcs; - num_csrcs_ = num_csrcs; // Update stored CSRCs. - } else { - // No change. - return; - } + // Copy new. + memcpy(current_remote_csrc_, + rtp_header.header.arrOfCSRCs, + num_csrcs * sizeof(uint32_t)); + + num_csrcs_ = num_csrcs; } // End critsect. - - bool have_called_callback = false; - // Search for new CSRC in old array. - for (uint8_t i = 0; i < rtp_header.header.numCSRCs; ++i) { - const uint32_t csrc = rtp_header.header.arrOfCSRCs[i]; - - bool found_match = false; - for (uint8_t j = 0; j < old_num_csrcs; ++j) { - if (csrc == old_remote_csrc[j]) { // old list - found_match = true; - break; - } - } - if (!found_match && csrc) { - // Didn't find it, report it as new. - have_called_callback = true; - cb_rtp_feedback_->OnIncomingCSRCChanged(csrc, true); - } - } - // Search for old CSRC in new array. - for (uint8_t i = 0; i < old_num_csrcs; ++i) { - const uint32_t csrc = old_remote_csrc[i]; - - bool found_match = false; - for (uint8_t j = 0; j < rtp_header.header.numCSRCs; ++j) { - if (csrc == rtp_header.header.arrOfCSRCs[j]) { - found_match = true; - break; - } - } - if (!found_match && csrc) { - // Did not find it, report as removed. - have_called_callback = true; - cb_rtp_feedback_->OnIncomingCSRCChanged(csrc, false); - } - } - if (!have_called_callback) { - // If the CSRC list contain non-unique entries we will end up here. - // Using CSRC 0 to signal this event, not interop safe, other - // implementations might have CSRC 0 as a valid value. - if (num_csrcs_diff > 0) { - cb_rtp_feedback_->OnIncomingCSRCChanged(0, true); - } else if (num_csrcs_diff < 0) { - cb_rtp_feedback_->OnIncomingCSRCChanged(0, false); - } - } } void RtpReceiverImpl::UpdateSources( diff --git a/modules/rtp_rtcp/source/rtp_receiver_strategy.h b/modules/rtp_rtcp/source/rtp_receiver_strategy.h index d5c51a278c..52cb5935fc 100644 --- a/modules/rtp_rtcp/source/rtp_receiver_strategy.h +++ b/modules/rtp_rtcp/source/rtp_receiver_strategy.h @@ -49,10 +49,6 @@ class RTPReceiverStrategy { virtual RTPAliveType ProcessDeadOrAlive( uint16_t last_payload_length) const = 0; - // Returns true if we should report CSRC changes for this payload type. - // TODO(phoglund): should move out of here along with other payload stuff. - virtual bool ShouldReportCsrcChanges(uint8_t payload_type) const = 0; - // Notifies the strategy that we have created a new non-RED audio payload type // in the payload registry. virtual int32_t OnNewPayloadTypeCreated( diff --git a/modules/rtp_rtcp/source/rtp_receiver_video.cc b/modules/rtp_rtcp/source/rtp_receiver_video.cc index 6efe6b52c3..454d3ef827 100644 --- a/modules/rtp_rtcp/source/rtp_receiver_video.cc +++ b/modules/rtp_rtcp/source/rtp_receiver_video.cc @@ -38,11 +38,6 @@ RTPReceiverVideo::RTPReceiverVideo(RtpData* data_callback) RTPReceiverVideo::~RTPReceiverVideo() { } -bool RTPReceiverVideo::ShouldReportCsrcChanges(uint8_t payload_type) const { - // Always do this for video packets. - return true; -} - int32_t RTPReceiverVideo::OnNewPayloadTypeCreated( int payload_type, const SdpAudioFormat& audio_format) { diff --git a/modules/rtp_rtcp/source/rtp_receiver_video.h b/modules/rtp_rtcp/source/rtp_receiver_video.h index 3e95456de2..d9404d1ef7 100644 --- a/modules/rtp_rtcp/source/rtp_receiver_video.h +++ b/modules/rtp_rtcp/source/rtp_receiver_video.h @@ -35,8 +35,6 @@ class RTPReceiverVideo : public RTPReceiverStrategy { RTPAliveType ProcessDeadOrAlive(uint16_t last_payload_length) const override; - bool ShouldReportCsrcChanges(uint8_t payload_type) const override; - int32_t OnNewPayloadTypeCreated(int payload_type, const SdpAudioFormat& audio_format) override; diff --git a/video/rtp_video_stream_receiver.h b/video/rtp_video_stream_receiver.h index 83d52d681a..b101e03de9 100644 --- a/video/rtp_video_stream_receiver.h +++ b/video/rtp_video_stream_receiver.h @@ -109,7 +109,6 @@ class RtpVideoStreamReceiver : public RtpData, // Implements RtpFeedback. void OnIncomingSSRCChanged(uint32_t ssrc) override {} - void OnIncomingCSRCChanged(uint32_t CSRC, bool added) override {} // Implements VCMFrameTypeCallback. int32_t RequestKeyFrame() override;