diff --git a/webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h b/webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h index 31080fcee..54aadf5d3 100644 --- a/webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h +++ b/webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h @@ -510,6 +510,8 @@ class RtpRtcp : public Module { */ virtual void SetRtcpXrRrtrStatus(bool enable) = 0; + virtual bool RtcpXrRrtrStatus() const = 0; + /* * (REMB) Receiver Estimated Max Bitrate */ diff --git a/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h b/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h index 09c3ca623..90ea4f848 100644 --- a/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h +++ b/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h @@ -170,6 +170,8 @@ class MockRtpRtcp : public RtpRtcp { int32_t(const RTCPVoIPMetric* VoIPMetric)); MOCK_METHOD1(SetRtcpXrRrtrStatus, void(bool enable)); + MOCK_CONST_METHOD0(RtcpXrRrtrStatus, + bool()); MOCK_CONST_METHOD0(REMB, bool()); MOCK_METHOD1(SetREMBStatus, diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc index 7962e97fd..a407a42c9 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc @@ -2182,6 +2182,11 @@ void RTCPSender::SendRtcpXrReceiverReferenceTime(bool enable) { xrSendReceiverReferenceTimeEnabled_ = enable; } +bool RTCPSender::RtcpXrReceiverReferenceTime() const { + CriticalSectionScoped lock(_criticalSectionRTCPSender); + return xrSendReceiverReferenceTimeEnabled_; +} + // called under critsect _criticalSectionRTCPSender int32_t RTCPSender::WriteAllReportBlocksToBuffer( uint8_t* rtcpbuffer, diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_sender.h b/webrtc/modules/rtp_rtcp/source/rtcp_sender.h index 106a78dda..9ed582444 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_sender.h +++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender.h @@ -171,6 +171,8 @@ public: void SendRtcpXrReceiverReferenceTime(bool enable); + bool RtcpXrReceiverReferenceTime() const; + int32_t SetCSRCs(const uint32_t arrOfCSRC[kRtpCsrcSize], const uint8_t arrLength); diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc index 7f1596686..6c5aff9f5 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc @@ -963,6 +963,10 @@ void ModuleRtpRtcpImpl::SetRtcpXrRrtrStatus(bool enable) { return rtcp_sender_.SendRtcpXrReceiverReferenceTime(enable); } +bool ModuleRtpRtcpImpl::RtcpXrRrtrStatus() const { + return rtcp_sender_.RtcpXrReceiverReferenceTime(); +} + int32_t ModuleRtpRtcpImpl::DataCountersRTP( uint32_t* bytes_sent, uint32_t* packets_sent) const { diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h index 05ad6c303..940a65633 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h +++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h @@ -259,6 +259,8 @@ class ModuleRtpRtcpImpl : public RtpRtcp { // (XR) Receiver reference time report. virtual void SetRtcpXrRrtrStatus(bool enable) OVERRIDE; + virtual bool RtcpXrRrtrStatus() const OVERRIDE; + // Audio part. // Set audio packet size, used to determine when it's time to send a DTMF diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc index deb428f5b..6248f4970 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc @@ -124,6 +124,12 @@ TEST_F(RtpRtcpImplTest, Rtt) { rtp_rtcp_impl_->RTT(kSsrc + 1, &rtt, &avg_rtt, &min_rtt, &max_rtt)); } +TEST_F(RtpRtcpImplTest, SetRtcpXrRrtrStatus) { + EXPECT_FALSE(rtp_rtcp_impl_->RtcpXrRrtrStatus()); + rtp_rtcp_impl_->SetRtcpXrRrtrStatus(true); + EXPECT_TRUE(rtp_rtcp_impl_->RtcpXrRrtrStatus()); +} + TEST_F(RtpRtcpImplTest, RttForReceiverOnly) { rtp_rtcp_impl_->SetRtcpXrRrtrStatus(true); EXPECT_EQ(0, rtp_rtcp_impl_->SetSendingStatus(false)); diff --git a/webrtc/video_engine/include/vie_rtp_rtcp.h b/webrtc/video_engine/include/vie_rtp_rtcp.h index 6f97ba586..7937d3552 100644 --- a/webrtc/video_engine/include/vie_rtp_rtcp.h +++ b/webrtc/video_engine/include/vie_rtp_rtcp.h @@ -254,6 +254,11 @@ class WEBRTC_DLLEXPORT ViERTP_RTCP { bool enable, int id) = 0; + // Enables/disables RTCP Receiver Reference Time Report Block extension/ + // DLRR Report Block extension (RFC 3611). + // TODO(asapersson): Remove default implementation. + virtual int SetRtcpXrRrtrStatus(int video_channel, bool enable) { return -1; } + // Enables transmission smoothening, i.e. packets belonging to the same frame // will be sent over a longer period of time instead of sending them // back-to-back. diff --git a/webrtc/video_engine/vie_channel.cc b/webrtc/video_engine/vie_channel.cc index 9e26a89c6..aa86673c9 100644 --- a/webrtc/video_engine/vie_channel.cc +++ b/webrtc/video_engine/vie_channel.cc @@ -406,6 +406,7 @@ int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec, rtp_rtcp->DeregisterSendRtpHeaderExtension( kRtpExtensionAbsoluteSendTime); } + rtp_rtcp->SetRtcpXrRrtrStatus(rtp_rtcp_->RtcpXrRrtrStatus()); } // |RegisterSimulcastRtpRtcpModules| resets all old weak pointers and old // modules can be deleted after this step. @@ -922,6 +923,15 @@ bool ViEChannel::GetReceiveAbsoluteSendTimeStatus() const { return receive_absolute_send_time_enabled_; } +void ViEChannel::SetRtcpXrRrtrStatus(bool enable) { + CriticalSectionScoped cs(rtp_rtcp_cs_.get()); + rtp_rtcp_->SetRtcpXrRrtrStatus(enable); + for (std::list::iterator it = simulcast_rtp_rtcp_.begin(); + it != simulcast_rtp_rtcp_.end(); it++) { + (*it)->SetRtcpXrRrtrStatus(enable); + } +} + void ViEChannel::SetTransmissionSmoothingStatus(bool enable) { assert(paced_sender_ && "No paced sender registered."); paced_sender_->SetStatus(enable); diff --git a/webrtc/video_engine/vie_channel.h b/webrtc/video_engine/vie_channel.h index 01c60f35c..3b3714050 100644 --- a/webrtc/video_engine/vie_channel.h +++ b/webrtc/video_engine/vie_channel.h @@ -125,6 +125,7 @@ class ViEChannel int SetSendAbsoluteSendTimeStatus(bool enable, int id); int SetReceiveAbsoluteSendTimeStatus(bool enable, int id); bool GetReceiveAbsoluteSendTimeStatus() const; + void SetRtcpXrRrtrStatus(bool enable); void SetTransmissionSmoothingStatus(bool enable); int32_t EnableTMMBR(const bool enable); int32_t EnableKeyFrameRequestCallback(const bool enable); diff --git a/webrtc/video_engine/vie_rtp_rtcp_impl.cc b/webrtc/video_engine/vie_rtp_rtcp_impl.cc index f824b3c72..7d3c8ad25 100644 --- a/webrtc/video_engine/vie_rtp_rtcp_impl.cc +++ b/webrtc/video_engine/vie_rtp_rtcp_impl.cc @@ -804,6 +804,25 @@ int ViERTP_RTCPImpl::SetReceiveAbsoluteSendTimeStatus(int video_channel, return 0; } +int ViERTP_RTCPImpl::SetRtcpXrRrtrStatus(int video_channel, bool enable) { + WEBRTC_TRACE(kTraceApiCall, kTraceVideo, + ViEId(shared_data_->instance_id(), video_channel), + "ViERTP_RTCPImpl::SetRtcpXrRrtrStatus(%d, %d)", + video_channel, enable); + + ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); + ViEChannel* vie_channel = cs.Channel(video_channel); + if (!vie_channel) { + WEBRTC_TRACE(kTraceError, kTraceVideo, + ViEId(shared_data_->instance_id(), video_channel), + "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); + shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); + return -1; + } + vie_channel->SetRtcpXrRrtrStatus(enable); + return 0; +} + int ViERTP_RTCPImpl::SetTransmissionSmoothingStatus(int video_channel, bool enable) { WEBRTC_TRACE(kTraceApiCall, kTraceVideo, diff --git a/webrtc/video_engine/vie_rtp_rtcp_impl.h b/webrtc/video_engine/vie_rtp_rtcp_impl.h index d7c76616c..caabd2cda 100644 --- a/webrtc/video_engine/vie_rtp_rtcp_impl.h +++ b/webrtc/video_engine/vie_rtp_rtcp_impl.h @@ -88,6 +88,7 @@ class ViERTP_RTCPImpl virtual int SetReceiveAbsoluteSendTimeStatus(int video_channel, bool enable, int id); + virtual int SetRtcpXrRrtrStatus(int video_channel, bool enable); virtual int SetTransmissionSmoothingStatus(int video_channel, bool enable); virtual int GetReceiveChannelRtcpStatistics(const int video_channel, RtcpStatistics& basic_stats,