OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 TEST_F(DelayBasedBweTest, ProbeDetection) { | 25 TEST_F(DelayBasedBweTest, ProbeDetection) { |
26 int64_t now_ms = clock_.TimeInMilliseconds(); | 26 int64_t now_ms = clock_.TimeInMilliseconds(); |
27 uint16_t seq_num = 0; | 27 uint16_t seq_num = 0; |
28 | 28 |
29 // First burst sent at 8 * 1000 / 10 = 800 kbps. | 29 // First burst sent at 8 * 1000 / 10 = 800 kbps. |
30 for (int i = 0; i < kNumProbes; ++i) { | 30 for (int i = 0; i < kNumProbes; ++i) { |
31 clock_.AdvanceTimeMilliseconds(10); | 31 clock_.AdvanceTimeMilliseconds(10); |
32 now_ms = clock_.TimeInMilliseconds(); | 32 now_ms = clock_.TimeInMilliseconds(); |
33 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, 0); | 33 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, 0); |
34 } | 34 } |
35 EXPECT_TRUE(bitrate_observer_->updated()); | 35 EXPECT_TRUE(bitrate_observer_.updated()); |
36 | 36 |
37 // Second burst sent at 8 * 1000 / 5 = 1600 kbps. | 37 // Second burst sent at 8 * 1000 / 5 = 1600 kbps. |
38 for (int i = 0; i < kNumProbes; ++i) { | 38 for (int i = 0; i < kNumProbes; ++i) { |
39 clock_.AdvanceTimeMilliseconds(5); | 39 clock_.AdvanceTimeMilliseconds(5); |
40 now_ms = clock_.TimeInMilliseconds(); | 40 now_ms = clock_.TimeInMilliseconds(); |
41 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, 1); | 41 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, 1); |
42 } | 42 } |
43 | 43 |
44 EXPECT_TRUE(bitrate_observer_->updated()); | 44 EXPECT_TRUE(bitrate_observer_.updated()); |
45 EXPECT_GT(bitrate_observer_->latest_bitrate(), 1500000u); | 45 EXPECT_GT(bitrate_observer_.latest_bitrate(), 1500000u); |
46 } | 46 } |
47 | 47 |
48 TEST_F(DelayBasedBweTest, ProbeDetectionNonPacedPackets) { | 48 TEST_F(DelayBasedBweTest, ProbeDetectionNonPacedPackets) { |
49 int64_t now_ms = clock_.TimeInMilliseconds(); | 49 int64_t now_ms = clock_.TimeInMilliseconds(); |
50 uint16_t seq_num = 0; | 50 uint16_t seq_num = 0; |
51 // First burst sent at 8 * 1000 / 10 = 800 kbps, but with every other packet | 51 // First burst sent at 8 * 1000 / 10 = 800 kbps, but with every other packet |
52 // not being paced which could mess things up. | 52 // not being paced which could mess things up. |
53 for (int i = 0; i < kNumProbes; ++i) { | 53 for (int i = 0; i < kNumProbes; ++i) { |
54 clock_.AdvanceTimeMilliseconds(5); | 54 clock_.AdvanceTimeMilliseconds(5); |
55 now_ms = clock_.TimeInMilliseconds(); | 55 now_ms = clock_.TimeInMilliseconds(); |
56 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, 0); | 56 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, 0); |
57 // Non-paced packet, arriving 5 ms after. | 57 // Non-paced packet, arriving 5 ms after. |
58 clock_.AdvanceTimeMilliseconds(5); | 58 clock_.AdvanceTimeMilliseconds(5); |
59 IncomingFeedback(now_ms, now_ms, seq_num++, | 59 IncomingFeedback(now_ms, now_ms, seq_num++, |
60 PacedSender::kMinProbePacketSize + 1, | 60 PacedSender::kMinProbePacketSize + 1, |
61 PacketInfo::kNotAProbe); | 61 PacketInfo::kNotAProbe); |
62 } | 62 } |
63 | 63 |
64 EXPECT_TRUE(bitrate_observer_->updated()); | 64 EXPECT_TRUE(bitrate_observer_.updated()); |
65 EXPECT_GT(bitrate_observer_->latest_bitrate(), 800000u); | 65 EXPECT_GT(bitrate_observer_.latest_bitrate(), 800000u); |
66 } | 66 } |
67 | 67 |
68 TEST_F(DelayBasedBweTest, ProbeDetectionFasterArrival) { | 68 TEST_F(DelayBasedBweTest, ProbeDetectionFasterArrival) { |
69 int64_t now_ms = clock_.TimeInMilliseconds(); | 69 int64_t now_ms = clock_.TimeInMilliseconds(); |
70 uint16_t seq_num = 0; | 70 uint16_t seq_num = 0; |
71 // First burst sent at 8 * 1000 / 10 = 800 kbps. | 71 // First burst sent at 8 * 1000 / 10 = 800 kbps. |
72 // Arriving at 8 * 1000 / 5 = 1600 kbps. | 72 // Arriving at 8 * 1000 / 5 = 1600 kbps. |
73 int64_t send_time_ms = 0; | 73 int64_t send_time_ms = 0; |
74 for (int i = 0; i < kNumProbes; ++i) { | 74 for (int i = 0; i < kNumProbes; ++i) { |
75 clock_.AdvanceTimeMilliseconds(1); | 75 clock_.AdvanceTimeMilliseconds(1); |
76 send_time_ms += 10; | 76 send_time_ms += 10; |
77 now_ms = clock_.TimeInMilliseconds(); | 77 now_ms = clock_.TimeInMilliseconds(); |
78 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, 0); | 78 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, 0); |
79 } | 79 } |
80 | 80 |
81 EXPECT_FALSE(bitrate_observer_->updated()); | 81 EXPECT_FALSE(bitrate_observer_.updated()); |
82 } | 82 } |
83 | 83 |
84 TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrival) { | 84 TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrival) { |
85 int64_t now_ms = clock_.TimeInMilliseconds(); | 85 int64_t now_ms = clock_.TimeInMilliseconds(); |
86 uint16_t seq_num = 0; | 86 uint16_t seq_num = 0; |
87 // First burst sent at 8 * 1000 / 5 = 1600 kbps. | 87 // First burst sent at 8 * 1000 / 5 = 1600 kbps. |
88 // Arriving at 8 * 1000 / 7 = 1142 kbps. | 88 // Arriving at 8 * 1000 / 7 = 1142 kbps. |
89 int64_t send_time_ms = 0; | 89 int64_t send_time_ms = 0; |
90 for (int i = 0; i < kNumProbes; ++i) { | 90 for (int i = 0; i < kNumProbes; ++i) { |
91 clock_.AdvanceTimeMilliseconds(7); | 91 clock_.AdvanceTimeMilliseconds(7); |
92 send_time_ms += 5; | 92 send_time_ms += 5; |
93 now_ms = clock_.TimeInMilliseconds(); | 93 now_ms = clock_.TimeInMilliseconds(); |
94 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, 1); | 94 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, 1); |
95 } | 95 } |
96 | 96 |
97 EXPECT_TRUE(bitrate_observer_->updated()); | 97 EXPECT_TRUE(bitrate_observer_.updated()); |
98 EXPECT_NEAR(bitrate_observer_->latest_bitrate(), 1140000u, 10000u); | 98 EXPECT_NEAR(bitrate_observer_.latest_bitrate(), 1140000u, 10000u); |
99 } | 99 } |
100 | 100 |
101 TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrivalHighBitrate) { | 101 TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrivalHighBitrate) { |
102 int64_t now_ms = clock_.TimeInMilliseconds(); | 102 int64_t now_ms = clock_.TimeInMilliseconds(); |
103 uint16_t seq_num = 0; | 103 uint16_t seq_num = 0; |
104 // Burst sent at 8 * 1000 / 1 = 8000 kbps. | 104 // Burst sent at 8 * 1000 / 1 = 8000 kbps. |
105 // Arriving at 8 * 1000 / 2 = 4000 kbps. | 105 // Arriving at 8 * 1000 / 2 = 4000 kbps. |
106 int64_t send_time_ms = 0; | 106 int64_t send_time_ms = 0; |
107 for (int i = 0; i < kNumProbes; ++i) { | 107 for (int i = 0; i < kNumProbes; ++i) { |
108 clock_.AdvanceTimeMilliseconds(2); | 108 clock_.AdvanceTimeMilliseconds(2); |
109 send_time_ms += 1; | 109 send_time_ms += 1; |
110 now_ms = clock_.TimeInMilliseconds(); | 110 now_ms = clock_.TimeInMilliseconds(); |
111 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, 1); | 111 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, 1); |
112 } | 112 } |
113 | 113 |
114 EXPECT_TRUE(bitrate_observer_->updated()); | 114 EXPECT_TRUE(bitrate_observer_.updated()); |
115 EXPECT_NEAR(bitrate_observer_->latest_bitrate(), 4000000u, 10000u); | 115 EXPECT_NEAR(bitrate_observer_.latest_bitrate(), 4000000u, 10000u); |
116 } | 116 } |
117 | 117 |
118 TEST_F(DelayBasedBweTest, InitialBehavior) { | 118 TEST_F(DelayBasedBweTest, InitialBehavior) { |
119 InitialBehaviorTestHelper(674840); | 119 InitialBehaviorTestHelper(674840); |
120 } | 120 } |
121 | 121 |
122 TEST_F(DelayBasedBweTest, RateIncreaseReordering) { | 122 TEST_F(DelayBasedBweTest, RateIncreaseReordering) { |
123 RateIncreaseReorderingTestHelper(674840); | 123 RateIncreaseReorderingTestHelper(674840); |
124 } | 124 } |
125 | 125 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 175 } |
176 | 176 |
177 TEST_F(DelayBasedBweTest, TestLongTimeoutAndWrap) { | 177 TEST_F(DelayBasedBweTest, TestLongTimeoutAndWrap) { |
178 // Simulate a client leaving and rejoining the call after some multiple of | 178 // Simulate a client leaving and rejoining the call after some multiple of |
179 // 64 seconds later. This will cause a zero difference in abs send times due | 179 // 64 seconds later. This will cause a zero difference in abs send times due |
180 // to the wrap, but a big difference in arrival time, if streams aren't | 180 // to the wrap, but a big difference in arrival time, if streams aren't |
181 // properly timed out. | 181 // properly timed out. |
182 TestWrappingHelper(10 * 64); | 182 TestWrappingHelper(10 * 64); |
183 } | 183 } |
184 } // namespace webrtc | 184 } // namespace webrtc |
OLD | NEW |