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..01cf7cbe3dd68880a64365d82a2b371e6ce8df0a 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,43 @@ 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 kPacketSizeBytes = 125; |
+ const int64_t kExpectedSendTimeUs = |
+ (kPacketSizeBytes * 8 * 1000 + kCapacityKbps / 2) / kCapacityKbps; |
+ uint16_t sequence_number = 0; |
+ int64_t send_time_us = 0; |
+ ChokeFilter filter(NULL, 0); |
+ filter.SetCapacity(10); |
+ Packets packets; |
+ RTPHeader header; |
+ for (int i = 0; i < 2; ++i) { |
+ header.sequenceNumber = sequence_number++; |
+ // Payload is 1000 bits. |
+ packets.push_back( |
+ new MediaPacket(0, send_time_us, kPacketSizeBytes, header)); |
+ // Packets are sent far enough a part plus an extra millisecond so that they |
+ // will never be in the choke queue at the same time. |
+ 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 +753,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 +762,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) { |