Skip to content

Commit 236920f

Browse files
Only return Rtx mode in RTXSendStatus().
There is no need to return 'ssrc' and 'payloadtype' inside this function since they are never used. BUG= [email protected], [email protected] Review URL: https://webrtc-codereview.appspot.com/38569004 Patch from Changbin Shao <[email protected]>. git-svn-id: http://webrtc.googlecode.com/svn/trunk@8049 4adac7df-926f-26a2-2b94-8c16560cd09d
1 parent 1999d20 commit 236920f

File tree

11 files changed

+41
-71
lines changed

11 files changed

+41
-71
lines changed

webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,13 @@ class RtpRtcp : public Module {
220220
* Turn on/off sending RTX (RFC 4588). The modes can be set as a combination
221221
* of values of the enumerator RtxMode.
222222
*/
223-
virtual void SetRTXSendStatus(int modes) = 0;
223+
virtual void SetRtxSendStatus(int modes) = 0;
224+
225+
/*
226+
* Get status of sending RTX (RFC 4588). The returned value can be
227+
* a combination of values of the enumerator RtxMode.
228+
*/
229+
virtual int RtxSendStatus() const = 0;
224230

225231
// Sets the SSRC to use when sending RTX packets. This doesn't enable RTX,
226232
// only the SSRC is set.
@@ -230,12 +236,6 @@ class RtpRtcp : public Module {
230236
// doesn't enable RTX, only the payload type is set.
231237
virtual void SetRtxSendPayloadType(int payload_type) = 0;
232238

233-
/*
234-
* Get status of sending RTX (RFC 4588) on a specific SSRC.
235-
*/
236-
virtual void RTXSendStatus(int* modes, uint32_t* ssrc,
237-
int* payloadType) const = 0;
238-
239239
/*
240240
* sends kRtcpByeCode when going from true to false
241241
*

webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,8 @@ class MockRtpRtcp : public RtpRtcp {
9595
MOCK_METHOD1(SetCsrcs, void(const std::vector<uint32_t>& csrcs));
9696
MOCK_METHOD1(SetCSRCStatus,
9797
int32_t(const bool include));
98-
MOCK_METHOD1(SetRTXSendStatus,
99-
void(int modes));
100-
MOCK_CONST_METHOD3(RTXSendStatus,
101-
void(int* modes, uint32_t* ssrc, int* payload_type));
98+
MOCK_METHOD1(SetRtxSendStatus, void(int modes));
99+
MOCK_CONST_METHOD0(RtxSendStatus, int());
102100
MOCK_METHOD1(SetRtxSsrc,
103101
void(uint32_t));
104102
MOCK_METHOD1(SetRtxSendPayloadType,

webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class RtpRtcpRtxNackTest : public ::testing::Test {
259259

260260
void RunRtxTest(RtxMode rtx_method, int loss) {
261261
rtp_payload_registry_.SetRtxSsrc(kTestSsrc + 1);
262-
rtp_rtcp_module_->SetRTXSendStatus(rtx_method);
262+
rtp_rtcp_module_->SetRtxSendStatus(rtx_method);
263263
rtp_rtcp_module_->SetRtxSsrc(kTestSsrc + 1);
264264
transport_.DropEveryNthPacket(loss);
265265
uint32_t timestamp = 3000;

webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc

+6-12
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,12 @@ int32_t ModuleRtpRtcpImpl::Process() {
243243
return 0;
244244
}
245245

246-
void ModuleRtpRtcpImpl::SetRTXSendStatus(int mode) {
247-
rtp_sender_.SetRTXStatus(mode);
246+
void ModuleRtpRtcpImpl::SetRtxSendStatus(int mode) {
247+
rtp_sender_.SetRtxStatus(mode);
248248
}
249249

250-
void ModuleRtpRtcpImpl::RTXSendStatus(int* mode,
251-
uint32_t* ssrc,
252-
int* payload_type) const {
253-
rtp_sender_.RTXStatus(mode, ssrc, payload_type);
250+
int ModuleRtpRtcpImpl::RtxSendStatus() const {
251+
return rtp_sender_.RtxStatus();
254252
}
255253

256254
void ModuleRtpRtcpImpl::SetRtxSsrc(uint32_t ssrc) {
@@ -1315,12 +1313,8 @@ int64_t ModuleRtpRtcpImpl::RtcpReportInterval() {
13151313
void ModuleRtpRtcpImpl::SetRtcpReceiverSsrcs(uint32_t main_ssrc) {
13161314
std::set<uint32_t> ssrcs;
13171315
ssrcs.insert(main_ssrc);
1318-
int rtx_mode = kRtxOff;
1319-
uint32_t rtx_ssrc = 0;
1320-
int rtx_payload_type = 0;
1321-
rtp_sender_.RTXStatus(&rtx_mode, &rtx_ssrc, &rtx_payload_type);
1322-
if (rtx_mode != kRtxOff)
1323-
ssrcs.insert(rtx_ssrc);
1316+
if (rtp_sender_.RtxStatus() != kRtxOff)
1317+
ssrcs.insert(rtp_sender_.RtxSsrc());
13241318
rtcp_receiver_.SetSsrcs(main_ssrc, ssrcs);
13251319
}
13261320

webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,8 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
8787

8888
int CurrentSendFrequencyHz() const;
8989

90-
virtual void SetRTXSendStatus(int mode) OVERRIDE;
91-
92-
virtual void RTXSendStatus(int* mode, uint32_t* ssrc,
93-
int* payloadType) const OVERRIDE;
90+
virtual void SetRtxSendStatus(int mode) OVERRIDE;
91+
virtual int RtxSendStatus() const OVERRIDE;
9492

9593
virtual void SetRtxSsrc(uint32_t ssrc) OVERRIDE;
9694

webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ TEST_F(RtpSendingTest, DISABLED_RoundRobinPaddingRtx) {
693693
1);
694694
senders_[i]->SetRtxSendPayloadType(96);
695695
senders_[i]->SetRtxSsrc(kSenderRtxSsrc + i);
696-
senders_[i]->SetRTXSendStatus(kRtxRetransmitted);
696+
senders_[i]->SetRtxSendStatus(kRtxRetransmitted);
697697
}
698698
transport_.ResetCounters();
699699
senders_[0]->TimeToSendPadding(500);
@@ -718,7 +718,7 @@ TEST_F(RtpSendingTest, DISABLED_RoundRobinPaddingRtxRedundantPayloads) {
718718
for (int i = 1; i < codec_.numberOfSimulcastStreams + 1; ++i) {
719719
senders_[i]->SetRtxSendPayloadType(96);
720720
senders_[i]->SetRtxSsrc(kSenderRtxSsrc + i);
721-
senders_[i]->SetRTXSendStatus(kRtxRetransmitted | kRtxRedundantPayloads);
721+
senders_[i]->SetRtxSendStatus(kRtxRetransmitted | kRtxRedundantPayloads);
722722
senders_[i]->SetStorePacketsStatus(true, 100);
723723
}
724724
// First send payloads so that we have something to retransmit.

webrtc/modules/rtp_rtcp/source/rtp_sender.cc

+6-9
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,16 @@ size_t RTPSender::MaxPayloadLength() const {
383383

384384
uint16_t RTPSender::PacketOverHead() const { return packet_over_head_; }
385385

386-
void RTPSender::SetRTXStatus(int mode) {
386+
void RTPSender::SetRtxStatus(int mode) {
387387
CriticalSectionScoped cs(send_critsect_);
388388
rtx_ = mode;
389389
}
390390

391+
int RTPSender::RtxStatus() const {
392+
CriticalSectionScoped cs(send_critsect_);
393+
return rtx_;
394+
}
395+
391396
void RTPSender::SetRtxSsrc(uint32_t ssrc) {
392397
CriticalSectionScoped cs(send_critsect_);
393398
ssrc_rtx_ = ssrc;
@@ -398,14 +403,6 @@ uint32_t RTPSender::RtxSsrc() const {
398403
return ssrc_rtx_;
399404
}
400405

401-
void RTPSender::RTXStatus(int* mode, uint32_t* ssrc,
402-
int* payload_type) const {
403-
CriticalSectionScoped cs(send_critsect_);
404-
*mode = rtx_;
405-
*ssrc = ssrc_rtx_;
406-
*payload_type = payload_type_rtx_;
407-
}
408-
409406
void RTPSender::SetRtxPayloadType(int payload_type) {
410407
CriticalSectionScoped cs(send_critsect_);
411408
payload_type_rtx_ = payload_type;

webrtc/modules/rtp_rtcp/source/rtp_sender.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,8 @@ class RTPSender : public RTPSenderInterface {
184184
bool ProcessNACKBitRate(uint32_t now);
185185

186186
// RTX.
187-
void SetRTXStatus(int mode);
188-
189-
void RTXStatus(int* mode, uint32_t* ssrc, int* payload_type) const;
187+
void SetRtxStatus(int mode);
188+
int RtxStatus() const;
190189

191190
uint32_t RtxSsrc() const;
192191
void SetRtxSsrc(uint32_t ssrc);

webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ TEST_F(RtpSenderTest, SendRedundantPayloads) {
667667
rtp_header_len += 4; // 4 bytes extension.
668668
rtp_header_len += 4; // 4 extra bytes common to all extension headers.
669669

670-
rtp_sender_->SetRTXStatus(kRtxRetransmitted | kRtxRedundantPayloads);
670+
rtp_sender_->SetRtxStatus(kRtxRetransmitted | kRtxRedundantPayloads);
671671
rtp_sender_->SetRtxSsrc(1234);
672672

673673
// Create and set up parser.
@@ -1124,7 +1124,7 @@ TEST_F(RtpSenderTest, BytesReportedCorrectly) {
11241124
rtp_sender_->SetSSRC(1234);
11251125
rtp_sender_->SetRtxSsrc(4321);
11261126
rtp_sender_->SetRtxPayloadType(kPayloadType - 1);
1127-
rtp_sender_->SetRTXStatus(kRtxRetransmitted | kRtxRedundantPayloads);
1127+
rtp_sender_->SetRtxStatus(kRtxRetransmitted | kRtxRedundantPayloads);
11281128

11291129
ASSERT_EQ(
11301130
0,

webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc

+8-19
Original file line numberDiff line numberDiff line change
@@ -103,28 +103,17 @@ TEST_F(RtpRtcpAPITest, RTCP) {
103103
}
104104

105105
TEST_F(RtpRtcpAPITest, RtxSender) {
106-
unsigned int ssrc = 0;
107-
int rtx_mode = kRtxOff;
108-
const int kRtxPayloadType = 119;
109-
int payload_type = -1;
110-
module->SetRTXSendStatus(kRtxRetransmitted);
111-
module->SetRtxSendPayloadType(kRtxPayloadType);
112-
module->SetRtxSsrc(1);
113-
module->RTXSendStatus(&rtx_mode, &ssrc, &payload_type);
106+
module->SetRtxSendStatus(kRtxRetransmitted);
107+
int rtx_mode = module->RtxSendStatus();
114108
EXPECT_EQ(kRtxRetransmitted, rtx_mode);
115-
EXPECT_EQ(1u, ssrc);
116-
EXPECT_EQ(kRtxPayloadType, payload_type);
117-
rtx_mode = kRtxOff;
118-
module->SetRTXSendStatus(kRtxOff);
119-
payload_type = -1;
120-
module->SetRtxSendPayloadType(kRtxPayloadType);
121-
module->RTXSendStatus(&rtx_mode, &ssrc, &payload_type);
109+
110+
module->SetRtxSendStatus(kRtxOff);
111+
rtx_mode = module->RtxSendStatus();
122112
EXPECT_EQ(kRtxOff, rtx_mode);
123-
EXPECT_EQ(kRtxPayloadType, payload_type);
124-
module->SetRTXSendStatus(kRtxRetransmitted);
125-
module->RTXSendStatus(&rtx_mode, &ssrc, &payload_type);
113+
114+
module->SetRtxSendStatus(kRtxRetransmitted);
115+
rtx_mode = module->RtxSendStatus();
126116
EXPECT_EQ(kRtxRetransmitted, rtx_mode);
127-
EXPECT_EQ(kRtxPayloadType, payload_type);
128117
}
129118

130119
TEST_F(RtpRtcpAPITest, RtxReceiver) {

webrtc/video_engine/vie_channel.cc

+3-8
Original file line numberDiff line numberDiff line change
@@ -364,12 +364,7 @@ int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec,
364364
}
365365
rtp_rtcp->SetSendingStatus(rtp_rtcp_->Sending());
366366
rtp_rtcp->SetSendingMediaStatus(rtp_rtcp_->SendingMedia());
367-
368-
int mode;
369-
uint32_t ssrc;
370-
int payload_type;
371-
rtp_rtcp_->RTXSendStatus(&mode, &ssrc, &payload_type);
372-
rtp_rtcp->SetRTXSendStatus(mode);
367+
rtp_rtcp->SetRtxSendStatus(rtp_rtcp_->RtxSendStatus());
373368
simulcast_rtp_rtcp_.push_back(rtp_rtcp);
374369

375370
// Silently ignore error.
@@ -912,11 +907,11 @@ int ViEChannel::SetRtxSendPayloadType(int payload_type) {
912907
void ViEChannel::SetRtxSendStatus(bool enable) {
913908
int rtx_settings =
914909
enable ? kRtxRetransmitted | kRtxRedundantPayloads : kRtxOff;
915-
rtp_rtcp_->SetRTXSendStatus(rtx_settings);
910+
rtp_rtcp_->SetRtxSendStatus(rtx_settings);
916911
CriticalSectionScoped cs(rtp_rtcp_cs_.get());
917912
for (std::list<RtpRtcp*>::iterator it = simulcast_rtp_rtcp_.begin();
918913
it != simulcast_rtp_rtcp_.end(); it++) {
919-
(*it)->SetRTXSendStatus(rtx_settings);
914+
(*it)->SetRtxSendStatus(rtx_settings);
920915
}
921916
}
922917

0 commit comments

Comments
 (0)