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

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

Issue 1341743002: Add unit test for nack bandwidth constraint. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments Created 5 years, 3 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 | « no previous file | 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_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 409be1a66ce16ad7fb9b6f5c4559eadf5f154ae3..3fe96a6876eba5eb3af8aefc904c4a01730ad3d6 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
@@ -1348,6 +1348,35 @@ TEST_F(RtpSenderTest, BytesReportedCorrectly) {
rtx_stats.transmitted.TotalBytes());
}
+TEST_F(RtpSenderTest, RespectsNackBitrateLimit) {
+ const int32_t kPacketSize = 1400;
+ const int32_t kNumPackets = 30;
+
+ rtp_sender_->SetStorePacketsStatus(true, kNumPackets);
+ // Set bitrate (in kbps) to fit kNumPackets รก kPacketSize bytes in one second.
+ rtp_sender_->SetTargetBitrate(kNumPackets * kPacketSize * 8);
+ const uint16_t kStartSequenceNumber = rtp_sender_->SequenceNumber();
+ std::list<uint16_t> sequence_numbers;
+ for (int32_t i = 0; i < kNumPackets; ++i) {
+ sequence_numbers.push_back(kStartSequenceNumber + i);
+ fake_clock_.AdvanceTimeMilliseconds(1);
+ SendPacket(fake_clock_.TimeInMilliseconds(), kPacketSize);
+ }
+ EXPECT_EQ(kNumPackets, transport_.packets_sent_);
+
+ fake_clock_.AdvanceTimeMilliseconds(1000 - kNumPackets);
+
+ // Resending should work - brings the bandwidth up to the limit.
+ // NACK bitrate is capped to the same bitrate as the encoder, since the max
+ // protection overhead is 50% (see MediaOptimization::SetTargetRates).
+ rtp_sender_->OnReceivedNACK(sequence_numbers, 0);
+ EXPECT_EQ(kNumPackets * 2, transport_.packets_sent_);
+
+ // Resending should not work, bandwidth exceeded.
+ rtp_sender_->OnReceivedNACK(sequence_numbers, 0);
+ EXPECT_EQ(kNumPackets * 2, transport_.packets_sent_);
+}
+
// Verify that all packets of a frame have CVO byte set.
TEST_F(RtpSenderVideoTest, SendVideoWithCVO) {
RTPVideoHeader hdr = {0};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698