diff --git a/webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h b/webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h index 52dfeabf7..49565521d 100644 --- a/webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h +++ b/webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h @@ -220,7 +220,13 @@ class RtpRtcp : public Module { * Turn on/off sending RTX (RFC 4588). The modes can be set as a combination * of values of the enumerator RtxMode. */ - virtual void SetRTXSendStatus(int modes) = 0; + virtual void SetRtxSendStatus(int modes) = 0; + + /* + * Get status of sending RTX (RFC 4588). The returned value can be + * a combination of values of the enumerator RtxMode. + */ + virtual int RtxSendStatus() const = 0; // Sets the SSRC to use when sending RTX packets. This doesn't enable RTX, // only the SSRC is set. @@ -230,12 +236,6 @@ class RtpRtcp : public Module { // doesn't enable RTX, only the payload type is set. virtual void SetRtxSendPayloadType(int payload_type) = 0; - /* - * Get status of sending RTX (RFC 4588) on a specific SSRC. - */ - virtual void RTXSendStatus(int* modes, uint32_t* ssrc, - int* payloadType) const = 0; - /* * sends kRtcpByeCode when going from true to false * diff --git a/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h b/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h index 3ea1626aa..4ded6d0c4 100644 --- a/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h +++ b/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h @@ -95,10 +95,8 @@ class MockRtpRtcp : public RtpRtcp { MOCK_METHOD1(SetCsrcs, void(const std::vector& csrcs)); MOCK_METHOD1(SetCSRCStatus, int32_t(const bool include)); - MOCK_METHOD1(SetRTXSendStatus, - void(int modes)); - MOCK_CONST_METHOD3(RTXSendStatus, - void(int* modes, uint32_t* ssrc, int* payload_type)); + MOCK_METHOD1(SetRtxSendStatus, void(int modes)); + MOCK_CONST_METHOD0(RtxSendStatus, int()); MOCK_METHOD1(SetRtxSsrc, void(uint32_t)); MOCK_METHOD1(SetRtxSendPayloadType, diff --git a/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc b/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc index bfe0af076..89fa3e67a 100644 --- a/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc @@ -259,7 +259,7 @@ class RtpRtcpRtxNackTest : public ::testing::Test { void RunRtxTest(RtxMode rtx_method, int loss) { rtp_payload_registry_.SetRtxSsrc(kTestSsrc + 1); - rtp_rtcp_module_->SetRTXSendStatus(rtx_method); + rtp_rtcp_module_->SetRtxSendStatus(rtx_method); rtp_rtcp_module_->SetRtxSsrc(kTestSsrc + 1); transport_.DropEveryNthPacket(loss); uint32_t timestamp = 3000; diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc index 817a6be83..ba8ad0b89 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc @@ -243,14 +243,12 @@ int32_t ModuleRtpRtcpImpl::Process() { return 0; } -void ModuleRtpRtcpImpl::SetRTXSendStatus(int mode) { - rtp_sender_.SetRTXStatus(mode); +void ModuleRtpRtcpImpl::SetRtxSendStatus(int mode) { + rtp_sender_.SetRtxStatus(mode); } -void ModuleRtpRtcpImpl::RTXSendStatus(int* mode, - uint32_t* ssrc, - int* payload_type) const { - rtp_sender_.RTXStatus(mode, ssrc, payload_type); +int ModuleRtpRtcpImpl::RtxSendStatus() const { + return rtp_sender_.RtxStatus(); } void ModuleRtpRtcpImpl::SetRtxSsrc(uint32_t ssrc) { @@ -1315,12 +1313,8 @@ int64_t ModuleRtpRtcpImpl::RtcpReportInterval() { void ModuleRtpRtcpImpl::SetRtcpReceiverSsrcs(uint32_t main_ssrc) { std::set ssrcs; ssrcs.insert(main_ssrc); - int rtx_mode = kRtxOff; - uint32_t rtx_ssrc = 0; - int rtx_payload_type = 0; - rtp_sender_.RTXStatus(&rtx_mode, &rtx_ssrc, &rtx_payload_type); - if (rtx_mode != kRtxOff) - ssrcs.insert(rtx_ssrc); + if (rtp_sender_.RtxStatus() != kRtxOff) + ssrcs.insert(rtp_sender_.RtxSsrc()); rtcp_receiver_.SetSsrcs(main_ssrc, ssrcs); } diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h index 306f49aee..73eb034b8 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h +++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h @@ -87,10 +87,8 @@ class ModuleRtpRtcpImpl : public RtpRtcp { int CurrentSendFrequencyHz() const; - virtual void SetRTXSendStatus(int mode) OVERRIDE; - - virtual void RTXSendStatus(int* mode, uint32_t* ssrc, - int* payloadType) const OVERRIDE; + virtual void SetRtxSendStatus(int mode) OVERRIDE; + virtual int RtxSendStatus() const OVERRIDE; virtual void SetRtxSsrc(uint32_t ssrc) OVERRIDE; 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 7f209eaf5..867a0d305 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc @@ -693,7 +693,7 @@ TEST_F(RtpSendingTest, DISABLED_RoundRobinPaddingRtx) { 1); senders_[i]->SetRtxSendPayloadType(96); senders_[i]->SetRtxSsrc(kSenderRtxSsrc + i); - senders_[i]->SetRTXSendStatus(kRtxRetransmitted); + senders_[i]->SetRtxSendStatus(kRtxRetransmitted); } transport_.ResetCounters(); senders_[0]->TimeToSendPadding(500); @@ -718,7 +718,7 @@ TEST_F(RtpSendingTest, DISABLED_RoundRobinPaddingRtxRedundantPayloads) { for (int i = 1; i < codec_.numberOfSimulcastStreams + 1; ++i) { senders_[i]->SetRtxSendPayloadType(96); senders_[i]->SetRtxSsrc(kSenderRtxSsrc + i); - senders_[i]->SetRTXSendStatus(kRtxRetransmitted | kRtxRedundantPayloads); + senders_[i]->SetRtxSendStatus(kRtxRetransmitted | kRtxRedundantPayloads); senders_[i]->SetStorePacketsStatus(true, 100); } // First send payloads so that we have something to retransmit. diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc index 6801cfd78..79d69d18f 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc @@ -383,11 +383,16 @@ size_t RTPSender::MaxPayloadLength() const { uint16_t RTPSender::PacketOverHead() const { return packet_over_head_; } -void RTPSender::SetRTXStatus(int mode) { +void RTPSender::SetRtxStatus(int mode) { CriticalSectionScoped cs(send_critsect_); rtx_ = mode; } +int RTPSender::RtxStatus() const { + CriticalSectionScoped cs(send_critsect_); + return rtx_; +} + void RTPSender::SetRtxSsrc(uint32_t ssrc) { CriticalSectionScoped cs(send_critsect_); ssrc_rtx_ = ssrc; @@ -398,14 +403,6 @@ uint32_t RTPSender::RtxSsrc() const { return ssrc_rtx_; } -void RTPSender::RTXStatus(int* mode, uint32_t* ssrc, - int* payload_type) const { - CriticalSectionScoped cs(send_critsect_); - *mode = rtx_; - *ssrc = ssrc_rtx_; - *payload_type = payload_type_rtx_; -} - void RTPSender::SetRtxPayloadType(int payload_type) { CriticalSectionScoped cs(send_critsect_); payload_type_rtx_ = payload_type; diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender.h b/webrtc/modules/rtp_rtcp/source/rtp_sender.h index d2ee2fa40..da30dc162 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_sender.h +++ b/webrtc/modules/rtp_rtcp/source/rtp_sender.h @@ -184,9 +184,8 @@ class RTPSender : public RTPSenderInterface { bool ProcessNACKBitRate(uint32_t now); // RTX. - void SetRTXStatus(int mode); - - void RTXStatus(int* mode, uint32_t* ssrc, int* payload_type) const; + void SetRtxStatus(int mode); + int RtxStatus() const; uint32_t RtxSsrc() const; void SetRtxSsrc(uint32_t ssrc); diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc index 3946c449c..aef627c4d 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc @@ -667,7 +667,7 @@ TEST_F(RtpSenderTest, SendRedundantPayloads) { rtp_header_len += 4; // 4 bytes extension. rtp_header_len += 4; // 4 extra bytes common to all extension headers. - rtp_sender_->SetRTXStatus(kRtxRetransmitted | kRtxRedundantPayloads); + rtp_sender_->SetRtxStatus(kRtxRetransmitted | kRtxRedundantPayloads); rtp_sender_->SetRtxSsrc(1234); // Create and set up parser. @@ -1124,7 +1124,7 @@ TEST_F(RtpSenderTest, BytesReportedCorrectly) { rtp_sender_->SetSSRC(1234); rtp_sender_->SetRtxSsrc(4321); rtp_sender_->SetRtxPayloadType(kPayloadType - 1); - rtp_sender_->SetRTXStatus(kRtxRetransmitted | kRtxRedundantPayloads); + rtp_sender_->SetRtxStatus(kRtxRetransmitted | kRtxRedundantPayloads); ASSERT_EQ( 0, diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc b/webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc index ccc8cf26a..9893b0186 100644 --- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc +++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc @@ -103,28 +103,17 @@ TEST_F(RtpRtcpAPITest, RTCP) { } TEST_F(RtpRtcpAPITest, RtxSender) { - unsigned int ssrc = 0; - int rtx_mode = kRtxOff; - const int kRtxPayloadType = 119; - int payload_type = -1; - module->SetRTXSendStatus(kRtxRetransmitted); - module->SetRtxSendPayloadType(kRtxPayloadType); - module->SetRtxSsrc(1); - module->RTXSendStatus(&rtx_mode, &ssrc, &payload_type); + module->SetRtxSendStatus(kRtxRetransmitted); + int rtx_mode = module->RtxSendStatus(); EXPECT_EQ(kRtxRetransmitted, rtx_mode); - EXPECT_EQ(1u, ssrc); - EXPECT_EQ(kRtxPayloadType, payload_type); - rtx_mode = kRtxOff; - module->SetRTXSendStatus(kRtxOff); - payload_type = -1; - module->SetRtxSendPayloadType(kRtxPayloadType); - module->RTXSendStatus(&rtx_mode, &ssrc, &payload_type); + + module->SetRtxSendStatus(kRtxOff); + rtx_mode = module->RtxSendStatus(); EXPECT_EQ(kRtxOff, rtx_mode); - EXPECT_EQ(kRtxPayloadType, payload_type); - module->SetRTXSendStatus(kRtxRetransmitted); - module->RTXSendStatus(&rtx_mode, &ssrc, &payload_type); + + module->SetRtxSendStatus(kRtxRetransmitted); + rtx_mode = module->RtxSendStatus(); EXPECT_EQ(kRtxRetransmitted, rtx_mode); - EXPECT_EQ(kRtxPayloadType, payload_type); } TEST_F(RtpRtcpAPITest, RtxReceiver) { diff --git a/webrtc/video_engine/vie_channel.cc b/webrtc/video_engine/vie_channel.cc index 7b9d2cc40..ee560b42c 100644 --- a/webrtc/video_engine/vie_channel.cc +++ b/webrtc/video_engine/vie_channel.cc @@ -364,12 +364,7 @@ int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec, } rtp_rtcp->SetSendingStatus(rtp_rtcp_->Sending()); rtp_rtcp->SetSendingMediaStatus(rtp_rtcp_->SendingMedia()); - - int mode; - uint32_t ssrc; - int payload_type; - rtp_rtcp_->RTXSendStatus(&mode, &ssrc, &payload_type); - rtp_rtcp->SetRTXSendStatus(mode); + rtp_rtcp->SetRtxSendStatus(rtp_rtcp_->RtxSendStatus()); simulcast_rtp_rtcp_.push_back(rtp_rtcp); // Silently ignore error. @@ -912,11 +907,11 @@ int ViEChannel::SetRtxSendPayloadType(int payload_type) { void ViEChannel::SetRtxSendStatus(bool enable) { int rtx_settings = enable ? kRtxRetransmitted | kRtxRedundantPayloads : kRtxOff; - rtp_rtcp_->SetRTXSendStatus(rtx_settings); + rtp_rtcp_->SetRtxSendStatus(rtx_settings); CriticalSectionScoped cs(rtp_rtcp_cs_.get()); for (std::list::iterator it = simulcast_rtp_rtcp_.begin(); it != simulcast_rtp_rtcp_.end(); it++) { - (*it)->SetRTXSendStatus(rtx_settings); + (*it)->SetRtxSendStatus(rtx_settings); } }