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

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

Issue 1414563003: Remove time constraint on first retransmit of a packet. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Updated unit tests 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_packet_history.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc
index a30753adf9aaef3945ec88cb003280608b0a2645..63c95935ca57d2c4d801f973764b39bd8a0afb06 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc
@@ -161,6 +161,8 @@ TEST_F(RtpPacketHistoryTest, DontRetransmit) {
}
TEST_F(RtpPacketHistoryTest, MinResendTime) {
+ static const int64_t kMinRetransmitIntervalMs = 100;
+
hist_->SetStorePacketsStatus(true, 10);
size_t len = 0;
int64_t capture_time_ms = fake_clock_.TimeInMilliseconds();
@@ -168,22 +170,57 @@ TEST_F(RtpPacketHistoryTest, MinResendTime) {
EXPECT_EQ(0, hist_->PutRTPPacket(packet_, len, capture_time_ms,
kAllowRetransmission));
+ // First transmission: TimeToSendPacket() call from pacer.
int64_t time;
len = kMaxPacketLength;
- EXPECT_TRUE(hist_->GetPacketAndSetSendTime(kSeqNum, 100, false, packet_, &len,
- &time));
- fake_clock_.AdvanceTimeMilliseconds(100);
+ EXPECT_TRUE(
+ hist_->GetPacketAndSetSendTime(kSeqNum, 0, false, packet_, &len, &time));
+
+ fake_clock_.AdvanceTimeMilliseconds(kMinRetransmitIntervalMs);
// Time has elapsed.
len = kMaxPacketLength;
- EXPECT_TRUE(hist_->GetPacketAndSetSendTime(kSeqNum, 100, false, packet_, &len,
- &time));
+ EXPECT_TRUE(hist_->GetPacketAndSetSendTime(kSeqNum, kMinRetransmitIntervalMs,
+ true, packet_, &len, &time));
+ EXPECT_GT(len, 0u);
+ EXPECT_EQ(capture_time_ms, time);
+
+ fake_clock_.AdvanceTimeMilliseconds(kMinRetransmitIntervalMs - 1);
+ // Time has not elapsed. Packet should be found, but no bytes copied.
+ len = kMaxPacketLength;
+ EXPECT_FALSE(hist_->GetPacketAndSetSendTime(kSeqNum, kMinRetransmitIntervalMs,
+ true, packet_, &len, &time));
+}
+
+TEST_F(RtpPacketHistoryTest, EarlyFirstResend) {
+ static const int64_t kMinRetransmitIntervalMs = 100;
+
+ hist_->SetStorePacketsStatus(true, 10);
+ size_t len = 0;
+ int64_t capture_time_ms = fake_clock_.TimeInMilliseconds();
+ CreateRtpPacket(kSeqNum, kSsrc, kPayload, kTimestamp, packet_, &len);
+ EXPECT_EQ(0, hist_->PutRTPPacket(packet_, len, capture_time_ms,
+ kAllowRetransmission));
+
+ // First transmission: TimeToSendPacket() call from pacer.
+ int64_t time;
+ len = kMaxPacketLength;
+ EXPECT_TRUE(
+ hist_->GetPacketAndSetSendTime(kSeqNum, 0, false, packet_, &len, &time));
+
+ fake_clock_.AdvanceTimeMilliseconds(kMinRetransmitIntervalMs - 1);
+ // Time has not elapsed, but this is the first retransmission request so
+ // allow anyway.
+ len = kMaxPacketLength;
+ EXPECT_TRUE(hist_->GetPacketAndSetSendTime(kSeqNum, kMinRetransmitIntervalMs,
+ true, packet_, &len, &time));
EXPECT_GT(len, 0u);
EXPECT_EQ(capture_time_ms, time);
+ fake_clock_.AdvanceTimeMilliseconds(kMinRetransmitIntervalMs - 1);
// Time has not elapsed. Packet should be found, but no bytes copied.
len = kMaxPacketLength;
- EXPECT_FALSE(hist_->GetPacketAndSetSendTime(kSeqNum, 101, false, packet_,
- &len, &time));
+ EXPECT_FALSE(hist_->GetPacketAndSetSendTime(kSeqNum, kMinRetransmitIntervalMs,
+ true, packet_, &len, &time));
}
TEST_F(RtpPacketHistoryTest, DynamicExpansion) {
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_packet_history.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698