Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(692)

Unified Diff: webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc

Issue 1392513002: Disable pacer disabling. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Remove RTP FIR + test refactoring Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
index 305ea132e27b9a37e452f46b3167d5c5a715604f..6d30263fe7879bd5cee6cf79ba58fc9a2844a779 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
@@ -107,8 +107,8 @@ class MockRtpPacketSender : public RtpPacketSender {
MockRtpPacketSender() {}
virtual ~MockRtpPacketSender() {}
- MOCK_METHOD6(SendPacket,
- bool(Priority priority,
+ MOCK_METHOD6(InsertPacket,
+ void(Priority priority,
uint32_t ssrc,
uint16_t sequence_number,
int64_t capture_time_ms,
@@ -125,14 +125,17 @@ class RtpSenderTest : public ::testing::Test {
payload_(kPayload),
transport_(),
kMarkerBit(true) {
- EXPECT_CALL(mock_paced_sender_,
- SendPacket(_, _, _, _, _, _)).WillRepeatedly(testing::Return(true));
+ EXPECT_CALL(mock_paced_sender_, InsertPacket(_, _, _, _, _, _))
+ .WillRepeatedly(testing::Return());
}
- void SetUp() override {
+ void SetUp() override { SetUpRtpSender(true); }
+
+ void SetUpRtpSender(bool pacer) {
rtp_sender_.reset(new RTPSender(false, &fake_clock_, &transport_, nullptr,
- &mock_paced_sender_, nullptr, nullptr,
- nullptr, nullptr, nullptr));
+ pacer ? &mock_paced_sender_ : nullptr,
+ nullptr, nullptr, nullptr, nullptr,
+ nullptr));
rtp_sender_->SetSequenceNumber(kSeqNum);
}
@@ -174,10 +177,18 @@ class RtpSenderTest : public ::testing::Test {
}
};
+// TODO(pbos): Move tests over from WithoutPacer to RtpSenderTest as this is our
+// default code path.
+class RtpSenderTestWithoutPacer : public RtpSenderTest {
+ public:
+ void SetUp() override { SetUpRtpSender(false); }
+};
+
class RtpSenderVideoTest : public RtpSenderTest {
protected:
virtual void SetUp() override {
- RtpSenderTest::SetUp();
+ // TODO(pbos): Set up to use pacer.
+ SetUpRtpSender(false);
rtp_sender_video_.reset(
new RTPSenderVideo(&fake_clock_, rtp_sender_.get()));
}
@@ -213,7 +224,8 @@ class RtpSenderVideoTest : public RtpSenderTest {
}
};
-TEST_F(RtpSenderTest, RegisterRtpTransmissionTimeOffsetHeaderExtension) {
+TEST_F(RtpSenderTestWithoutPacer,
+ RegisterRtpTransmissionTimeOffsetHeaderExtension) {
EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionTotalLength());
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
kRtpExtensionTransmissionTimeOffset, kTransmissionTimeOffsetExtensionId));
@@ -224,7 +236,7 @@ TEST_F(RtpSenderTest, RegisterRtpTransmissionTimeOffsetHeaderExtension) {
EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionTotalLength());
}
-TEST_F(RtpSenderTest, RegisterRtpAbsoluteSendTimeHeaderExtension) {
+TEST_F(RtpSenderTestWithoutPacer, RegisterRtpAbsoluteSendTimeHeaderExtension) {
EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionTotalLength());
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
kRtpExtensionAbsoluteSendTime, kAbsoluteSendTimeExtensionId));
@@ -236,7 +248,7 @@ TEST_F(RtpSenderTest, RegisterRtpAbsoluteSendTimeHeaderExtension) {
EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionTotalLength());
}
-TEST_F(RtpSenderTest, RegisterRtpAudioLevelHeaderExtension) {
+TEST_F(RtpSenderTestWithoutPacer, RegisterRtpAudioLevelHeaderExtension) {
EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionTotalLength());
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
kRtpExtensionAudioLevel, kAudioLevelExtensionId));
@@ -248,7 +260,7 @@ TEST_F(RtpSenderTest, RegisterRtpAudioLevelHeaderExtension) {
EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionTotalLength());
}
-TEST_F(RtpSenderTest, RegisterRtpHeaderExtensions) {
+TEST_F(RtpSenderTestWithoutPacer, RegisterRtpHeaderExtensions) {
EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionTotalLength());
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
kRtpExtensionTransmissionTimeOffset, kTransmissionTimeOffsetExtensionId));
@@ -298,7 +310,7 @@ TEST_F(RtpSenderTest, RegisterRtpHeaderExtensions) {
EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionTotalLength());
}
-TEST_F(RtpSenderTest, RegisterRtpVideoRotationHeaderExtension) {
+TEST_F(RtpSenderTestWithoutPacer, RegisterRtpVideoRotationHeaderExtension) {
EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionTotalLength());
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
kRtpExtensionVideoRotation, kVideoRotationExtensionId));
@@ -313,7 +325,7 @@ TEST_F(RtpSenderTest, RegisterRtpVideoRotationHeaderExtension) {
EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionTotalLength());
}
-TEST_F(RtpSenderTest, BuildRTPPacket) {
+TEST_F(RtpSenderTestWithoutPacer, BuildRTPPacket) {
size_t length = static_cast<size_t>(rtp_sender_->BuildRTPheader(
packet_, kPayload, kMarkerBit, kTimestamp, 0));
ASSERT_EQ(kRtpHeaderSize, length);
@@ -338,7 +350,8 @@ TEST_F(RtpSenderTest, BuildRTPPacket) {
EXPECT_EQ(0u, rtp_header.extension.videoRotation);
}
-TEST_F(RtpSenderTest, BuildRTPPacketWithTransmissionOffsetExtension) {
+TEST_F(RtpSenderTestWithoutPacer,
+ BuildRTPPacketWithTransmissionOffsetExtension) {
EXPECT_EQ(0, rtp_sender_->SetTransmissionTimeOffset(kTimeOffset));
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
kRtpExtensionTransmissionTimeOffset, kTransmissionTimeOffsetExtensionId));
@@ -375,7 +388,8 @@ TEST_F(RtpSenderTest, BuildRTPPacketWithTransmissionOffsetExtension) {
EXPECT_EQ(0, rtp_header2.extension.transmissionTimeOffset);
}
-TEST_F(RtpSenderTest, BuildRTPPacketWithNegativeTransmissionOffsetExtension) {
+TEST_F(RtpSenderTestWithoutPacer,
+ BuildRTPPacketWithNegativeTransmissionOffsetExtension) {
const int kNegTimeOffset = -500;
EXPECT_EQ(0, rtp_sender_->SetTransmissionTimeOffset(kNegTimeOffset));
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
@@ -403,7 +417,7 @@ TEST_F(RtpSenderTest, BuildRTPPacketWithNegativeTransmissionOffsetExtension) {
EXPECT_EQ(kNegTimeOffset, rtp_header.extension.transmissionTimeOffset);
}
-TEST_F(RtpSenderTest, BuildRTPPacketWithAbsoluteSendTimeExtension) {
+TEST_F(RtpSenderTestWithoutPacer, BuildRTPPacketWithAbsoluteSendTimeExtension) {
EXPECT_EQ(0, rtp_sender_->SetAbsoluteSendTime(kAbsoluteSendTime));
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
kRtpExtensionAbsoluteSendTime, kAbsoluteSendTimeExtensionId));
@@ -440,7 +454,7 @@ TEST_F(RtpSenderTest, BuildRTPPacketWithAbsoluteSendTimeExtension) {
}
// Test CVO header extension is only set when marker bit is true.
-TEST_F(RtpSenderTest, BuildRTPPacketWithVideoRotation_MarkerBit) {
+TEST_F(RtpSenderTestWithoutPacer, BuildRTPPacketWithVideoRotation_MarkerBit) {
rtp_sender_->SetVideoRotation(kRotation);
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
kRtpExtensionVideoRotation, kVideoRotationExtensionId));
@@ -468,7 +482,8 @@ TEST_F(RtpSenderTest, BuildRTPPacketWithVideoRotation_MarkerBit) {
}
// Test CVO header extension is not set when marker bit is false.
-TEST_F(RtpSenderTest, DISABLED_BuildRTPPacketWithVideoRotation_NoMarkerBit) {
+TEST_F(RtpSenderTestWithoutPacer,
+ DISABLED_BuildRTPPacketWithVideoRotation_NoMarkerBit) {
rtp_sender_->SetVideoRotation(kRotation);
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
kRtpExtensionVideoRotation, kVideoRotationExtensionId));
@@ -492,7 +507,7 @@ TEST_F(RtpSenderTest, DISABLED_BuildRTPPacketWithVideoRotation_NoMarkerBit) {
EXPECT_FALSE(rtp_header.extension.hasVideoRotation);
}
-TEST_F(RtpSenderTest, BuildRTPPacketWithAudioLevelExtension) {
+TEST_F(RtpSenderTestWithoutPacer, BuildRTPPacketWithAudioLevelExtension) {
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
kRtpExtensionAudioLevel, kAudioLevelExtensionId));
@@ -533,7 +548,7 @@ TEST_F(RtpSenderTest, BuildRTPPacketWithAudioLevelExtension) {
EXPECT_EQ(0u, rtp_header2.extension.audioLevel);
}
-TEST_F(RtpSenderTest, BuildRTPPacketWithHeaderExtensions) {
+TEST_F(RtpSenderTestWithoutPacer, BuildRTPPacketWithHeaderExtensions) {
EXPECT_EQ(0, rtp_sender_->SetTransmissionTimeOffset(kTimeOffset));
EXPECT_EQ(0, rtp_sender_->SetAbsoluteSendTime(kAbsoluteSendTime));
EXPECT_EQ(0,
@@ -605,9 +620,9 @@ TEST_F(RtpSenderTest, BuildRTPPacketWithHeaderExtensions) {
}
TEST_F(RtpSenderTest, TrafficSmoothingWithExtensions) {
- EXPECT_CALL(mock_paced_sender_,
- SendPacket(RtpPacketSender::kNormalPriority, _, kSeqNum, _, _, _))
- .WillOnce(testing::Return(false));
+ EXPECT_CALL(mock_paced_sender_, InsertPacket(RtpPacketSender::kNormalPriority,
+ _, kSeqNum, _, _, _))
+ .WillRepeatedly(testing::Return());
rtp_sender_->SetStorePacketsStatus(true, 10);
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
@@ -655,9 +670,9 @@ TEST_F(RtpSenderTest, TrafficSmoothingWithExtensions) {
}
TEST_F(RtpSenderTest, TrafficSmoothingRetransmits) {
- EXPECT_CALL(mock_paced_sender_,
- SendPacket(RtpPacketSender::kNormalPriority, _, kSeqNum, _, _, _))
- .WillOnce(testing::Return(false));
+ EXPECT_CALL(mock_paced_sender_, InsertPacket(RtpPacketSender::kNormalPriority,
+ _, kSeqNum, _, _, _))
+ .WillRepeatedly(testing::Return());
rtp_sender_->SetStorePacketsStatus(true, 10);
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
@@ -679,8 +694,8 @@ TEST_F(RtpSenderTest, TrafficSmoothingRetransmits) {
EXPECT_EQ(0, transport_.packets_sent_);
EXPECT_CALL(mock_paced_sender_,
- SendPacket(RtpPacketSender::kHighPriority, _, kSeqNum, _, _, _))
- .WillOnce(testing::Return(false));
+ InsertPacket(RtpPacketSender::kHighPriority, _, kSeqNum, _, _, _))
+ .WillRepeatedly(testing::Return());
const int kStoredTimeInMs = 100;
fake_clock_.AdvanceTimeMilliseconds(kStoredTimeInMs);
@@ -717,8 +732,8 @@ TEST_F(RtpSenderTest, TrafficSmoothingRetransmits) {
TEST_F(RtpSenderTest, SendPadding) {
// Make all (non-padding) packets go to send queue.
EXPECT_CALL(mock_paced_sender_,
- SendPacket(RtpPacketSender::kNormalPriority, _, _, _, _, _))
- .WillRepeatedly(testing::Return(false));
+ InsertPacket(RtpPacketSender::kNormalPriority, _, _, _, _, _))
+ .WillRepeatedly(testing::Return());
uint16_t seq_num = kSeqNum;
uint32_t timestamp = kTimestamp;
@@ -837,8 +852,8 @@ TEST_F(RtpSenderTest, SendRedundantPayloads) {
rtp_sender_->SetRtxPayloadType(kRtxPayload, kPayload);
// Make all packets go through the pacer.
EXPECT_CALL(mock_paced_sender_,
- SendPacket(RtpPacketSender::kNormalPriority, _, _, _, _, _))
- .WillRepeatedly(testing::Return(false));
+ InsertPacket(RtpPacketSender::kNormalPriority, _, _, _, _, _))
+ .WillRepeatedly(testing::Return());
uint16_t seq_num = kSeqNum;
rtp_sender_->SetStorePacketsStatus(true, 10);
@@ -891,7 +906,7 @@ TEST_F(RtpSenderTest, SendRedundantPayloads) {
rtp_sender_->TimeToSendPadding(999));
}
-TEST_F(RtpSenderTest, SendGenericVideo) {
+TEST_F(RtpSenderTestWithoutPacer, SendGenericVideo) {
char payload_name[RTP_PAYLOAD_NAME_SIZE] = "GENERIC";
const uint8_t payload_type = 127;
ASSERT_EQ(0, rtp_sender_->RegisterPayload(payload_name, payload_type, 90000,
@@ -1017,8 +1032,8 @@ TEST_F(RtpSenderTest, BitrateCallbacks) {
BitrateStatistics retransmit_stats_;
} callback;
rtp_sender_.reset(new RTPSender(false, &fake_clock_, &transport_, nullptr,
- &mock_paced_sender_, nullptr, nullptr,
- &callback, nullptr, nullptr));
+ nullptr, nullptr, nullptr, &callback, nullptr,
+ nullptr));
// Simulate kNumPackets sent with kPacketInterval ms intervals.
const uint32_t kNumPackets = 15;
@@ -1076,13 +1091,13 @@ class RtpSenderAudioTest : public RtpSenderTest {
void SetUp() override {
payload_ = kAudioPayload;
rtp_sender_.reset(new RTPSender(true, &fake_clock_, &transport_, nullptr,
- &mock_paced_sender_, nullptr, nullptr,
- nullptr, nullptr, nullptr));
+ nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr));
rtp_sender_->SetSequenceNumber(kSeqNum);
}
};
-TEST_F(RtpSenderTest, StreamDataCountersCallbacks) {
+TEST_F(RtpSenderTestWithoutPacer, StreamDataCountersCallbacks) {
class TestCallback : public StreamDataCountersCallback {
public:
TestCallback()
@@ -1298,7 +1313,7 @@ TEST_F(RtpSenderAudioTest, CheckMarkerBitForTelephoneEvents) {
EXPECT_FALSE(rtp_header.markerBit);
}
-TEST_F(RtpSenderTest, BytesReportedCorrectly) {
+TEST_F(RtpSenderTestWithoutPacer, BytesReportedCorrectly) {
const char* kPayloadName = "GENERIC";
const uint8_t kPayloadType = 127;
rtp_sender_->SetSSRC(1234);
@@ -1351,7 +1366,7 @@ TEST_F(RtpSenderTest, BytesReportedCorrectly) {
rtx_stats.transmitted.TotalBytes());
}
-TEST_F(RtpSenderTest, RespectsNackBitrateLimit) {
+TEST_F(RtpSenderTestWithoutPacer, RespectsNackBitrateLimit) {
const int32_t kPacketSize = 1400;
const int32_t kNumPackets = 30;
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698