Chromium Code Reviews

Unified Diff: webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc

Issue 1233853002: Fix simulator issue where chokes didn't apply to non-congested packets. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added and fixed existing unittests. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc
index dd7bbfcfeba80b10e6ceca6c433dbd2e1d55b340..e01db1fb805187fc64d6b14ef2ccd81a105e614f 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc
@@ -657,13 +657,39 @@ class BweTestFramework_ChokeFilterTest : public ::testing::Test {
private:
int64_t now_ms_;
- uint32_t sequence_number_;
+ uint16_t sequence_number_;
Packets output_packets_;
std::vector<int64_t> send_times_us_;
DISALLOW_COPY_AND_ASSIGN(BweTestFramework_ChokeFilterTest);
};
+TEST_F(BweTestFramework_ChokeFilterTest, NoQueue) {
+ const int kCapacityKbps = 10;
+ const size_t kPacketSize = 125;
+ const int64_t kExpectedSendTimeUs = kPacketSize * 8 * 1000 / kCapacityKbps;
+ uint16_t sequence_number = 0;
+ int64_t send_time_us = 0;
+ ChokeFilter filter(NULL, 0);
+ filter.SetCapacity(10);
+ Packets packets;
+ RTPHeader header;
+ for (uint32_t i = 0; i < 2; ++i) {
+ header.sequenceNumber = sequence_number++;
+ // Payload is 1000 bits.
+ packets.push_back(new MediaPacket(0, send_time_us, 125, header));
+ send_time_us += kExpectedSendTimeUs + 1000;
+ }
+ ASSERT_TRUE(IsTimeSorted(packets));
+ filter.RunFor(2 * kExpectedSendTimeUs + 1000, &packets);
+ EXPECT_EQ(kExpectedSendTimeUs, packets.front()->send_time_us());
+ delete packets.front();
+ packets.pop_front();
+ EXPECT_EQ(2 * kExpectedSendTimeUs + 1000, packets.front()->send_time_us());
+ delete packets.front();
+ packets.pop_front();
+}
+
TEST_F(BweTestFramework_ChokeFilterTest, Short) {
// 100ms, 100 packets, 10 kbps choke -> 1 kbit of data should have propagated.
// That is actually just a single packet, since each packet has 1000 bits of
@@ -723,8 +749,8 @@ TEST_F(BweTestFramework_ChokeFilterTest, MaxDelay) {
// 100 ms delay cap
filter.SetMaxDelay(100);
- // 10100ms, 50 more packets -> 2 packets or 2 kbit through.
- TestChoke(&filter, 100, 50, 2);
+ // 10100ms, 50 more packets -> 1 packets or 1 kbit through.
+ TestChoke(&filter, 100, 50, 1);
CheckMaxDelay(100);
// 20000ms, no input, remaining packets in queue should have been dropped.
TestChoke(&filter, 9900, 0, 0);
@@ -732,8 +758,8 @@ TEST_F(BweTestFramework_ChokeFilterTest, MaxDelay) {
// Reset delay cap (0 is no cap) and verify no packets are dropped.
filter.SetCapacity(10);
filter.SetMaxDelay(0);
- TestChoke(&filter, 100, 100, 2);
- TestChoke(&filter, 9900, 0, 98);
+ TestChoke(&filter, 100, 100, 1);
+ TestChoke(&filter, 9900, 0, 99);
}
TEST_F(BweTestFramework_ChokeFilterTest, ShortTrace) {
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine