Only return Rtx mode in RTXSendStatus().
There is no need to return 'ssrc' and 'payloadtype' inside this function
since they are never used.
BUG=
R=pbos@webrtc.org, stefan@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/38569004
Patch from Changbin Shao <changbin.shao@intel.com>.
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@8049 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/modules/rtp_rtcp/interface/rtp_rtcp.h b/modules/rtp_rtcp/interface/rtp_rtcp.h
index 52dfeab..4956552 100644
--- a/modules/rtp_rtcp/interface/rtp_rtcp.h
+++ b/modules/rtp_rtcp/interface/rtp_rtcp.h
@@ -220,7 +220,13 @@
* 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.
@@ -231,12 +237,6 @@
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
*
* sending - on/off
diff --git a/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h b/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h
index 3ea1626..4ded6d0 100644
--- a/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h
+++ b/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h
@@ -95,10 +95,8 @@
MOCK_METHOD1(SetCsrcs, void(const std::vector<uint32_t>& 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/modules/rtp_rtcp/source/nack_rtx_unittest.cc b/modules/rtp_rtcp/source/nack_rtx_unittest.cc
index bfe0af0..89fa3e6 100644
--- a/modules/rtp_rtcp/source/nack_rtx_unittest.cc
+++ b/modules/rtp_rtcp/source/nack_rtx_unittest.cc
@@ -259,7 +259,7 @@
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/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index 817a6be..ba8ad0b 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -243,14 +243,12 @@
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 @@
void ModuleRtpRtcpImpl::SetRtcpReceiverSsrcs(uint32_t main_ssrc) {
std::set<uint32_t> 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/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
index 306f49a..73eb034 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
@@ -87,10 +87,8 @@
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/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc
index 7f209ea..867a0d3 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc
@@ -693,7 +693,7 @@
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 @@
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/modules/rtp_rtcp/source/rtp_sender.cc b/modules/rtp_rtcp/source/rtp_sender.cc
index 6801cfd..79d69d1 100644
--- a/modules/rtp_rtcp/source/rtp_sender.cc
+++ b/modules/rtp_rtcp/source/rtp_sender.cc
@@ -383,11 +383,16 @@
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 @@
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/modules/rtp_rtcp/source/rtp_sender.h b/modules/rtp_rtcp/source/rtp_sender.h
index d2ee2fa..da30dc1 100644
--- a/modules/rtp_rtcp/source/rtp_sender.h
+++ b/modules/rtp_rtcp/source/rtp_sender.h
@@ -184,9 +184,8 @@
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/modules/rtp_rtcp/source/rtp_sender_unittest.cc b/modules/rtp_rtcp/source/rtp_sender_unittest.cc
index 3946c44..aef627c 100644
--- a/modules/rtp_rtcp/source/rtp_sender_unittest.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_unittest.cc
@@ -667,7 +667,7 @@
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 @@
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/modules/rtp_rtcp/test/testAPI/test_api.cc b/modules/rtp_rtcp/test/testAPI/test_api.cc
index ccc8cf2..9893b01 100644
--- a/modules/rtp_rtcp/test/testAPI/test_api.cc
+++ b/modules/rtp_rtcp/test/testAPI/test_api.cc
@@ -103,28 +103,17 @@
}
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/video_engine/vie_channel.cc b/video_engine/vie_channel.cc
index 7b9d2cc..ee560b4 100644
--- a/video_engine/vie_channel.cc
+++ b/video_engine/vie_channel.cc
@@ -364,12 +364,7 @@
}
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 @@
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<RtpRtcp*>::iterator it = simulcast_rtp_rtcp_.begin();
it != simulcast_rtp_rtcp_.end(); it++) {
- (*it)->SetRTXSendStatus(rtx_settings);
+ (*it)->SetRtxSendStatus(rtx_settings);
}
}