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@8049 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2015-01-13 14:15:15 +00:00
parent 3df38b442f
commit 0b0c24177b
11 changed files with 41 additions and 71 deletions

View File

@ -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
*

View File

@ -95,10 +95,8 @@ class MockRtpRtcp : public RtpRtcp {
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,

View File

@ -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;

View File

@ -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<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);
}

View File

@ -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;

View File

@ -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.

View File

@ -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;

View File

@ -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);

View File

@ -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,

View File

@ -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) {

View File

@ -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<RtpRtcp*>::iterator it = simulcast_rtp_rtcp_.begin();
it != simulcast_rtp_rtcp_.end(); it++) {
(*it)->SetRTXSendStatus(rtx_settings);
(*it)->SetRtxSendStatus(rtx_settings);
}
}