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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // Packets will require 5 ms to be transmitted to the receiver, causing packets | |
69 // of the second probe to be dispersed. | |
70 TEST_F(DelayBasedBweTest, ProbeDetectionTooHighBitrate) { | |
71 int64_t now_ms = clock_.TimeInMilliseconds(); | |
72 int64_t send_time_ms = 0; | |
73 uint16_t seq_num = 0; | |
74 // First burst sent at 8 * 1000 / 10 = 800 kbps. | |
75 for (int i = 0; i < kNumProbes; ++i) { | |
76 clock_.AdvanceTimeMilliseconds(10); | |
77 now_ms = clock_.TimeInMilliseconds(); | |
78 send_time_ms += 10; | |
79 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, 0); | |
80 } | |
81 | |
82 // Second burst sent at 8 * 1000 / 5 = 1600 kbps, arriving at 8 * 1000 / 8 = | |
83 // 1000 kbps. | |
84 for (int i = 0; i < kNumProbes; ++i) { | |
85 clock_.AdvanceTimeMilliseconds(8); | |
86 now_ms = clock_.TimeInMilliseconds(); | |
87 send_time_ms += 5; | |
88 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, 1); | |
89 } | |
90 | |
91 EXPECT_TRUE(bitrate_observer_->updated()); | |
92 EXPECT_NEAR(bitrate_observer_->latest_bitrate(), 800000u, 10000u); | |
93 } | |
94 | |
95 TEST_F(DelayBasedBweTest, ProbeDetectionSlightlyFasterArrival) { | |
96 int64_t now_ms = clock_.TimeInMilliseconds(); | |
97 uint16_t seq_num = 0; | |
98 // First burst sent at 8 * 1000 / 10 = 800 kbps. | |
99 // Arriving at 8 * 1000 / 5 = 1600 kbps. | |
100 int64_t send_time_ms = 0; | |
101 for (int i = 0; i < kNumProbes; ++i) { | |
102 clock_.AdvanceTimeMilliseconds(5); | |
103 send_time_ms += 10; | |
104 now_ms = clock_.TimeInMilliseconds(); | |
105 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, 23); | |
106 } | |
107 | |
108 EXPECT_TRUE(bitrate_observer_->updated()); | |
109 EXPECT_GT(bitrate_observer_->latest_bitrate(), 800000u); | |
110 } | |
111 | |
112 TEST_F(DelayBasedBweTest, ProbeDetectionFasterArrival) { | 68 TEST_F(DelayBasedBweTest, ProbeDetectionFasterArrival) { |
113 int64_t now_ms = clock_.TimeInMilliseconds(); | 69 int64_t now_ms = clock_.TimeInMilliseconds(); |
114 uint16_t seq_num = 0; | 70 uint16_t seq_num = 0; |
115 // First burst sent at 8 * 1000 / 10 = 800 kbps. | 71 // First burst sent at 8 * 1000 / 10 = 800 kbps. |
116 // Arriving at 8 * 1000 / 5 = 1600 kbps. | 72 // Arriving at 8 * 1000 / 5 = 1600 kbps. |
117 int64_t send_time_ms = 0; | 73 int64_t send_time_ms = 0; |
118 for (int i = 0; i < kNumProbes; ++i) { | 74 for (int i = 0; i < kNumProbes; ++i) { |
119 clock_.AdvanceTimeMilliseconds(1); | 75 clock_.AdvanceTimeMilliseconds(1); |
120 send_time_ms += 10; | 76 send_time_ms += 10; |
121 now_ms = clock_.TimeInMilliseconds(); | 77 now_ms = clock_.TimeInMilliseconds(); |
(...skipping 30 matching lines...) Expand all Loading... |
152 clock_.AdvanceTimeMilliseconds(2); | 108 clock_.AdvanceTimeMilliseconds(2); |
153 send_time_ms += 1; | 109 send_time_ms += 1; |
154 now_ms = clock_.TimeInMilliseconds(); | 110 now_ms = clock_.TimeInMilliseconds(); |
155 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, 1); | 111 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, 1); |
156 } | 112 } |
157 | 113 |
158 EXPECT_TRUE(bitrate_observer_->updated()); | 114 EXPECT_TRUE(bitrate_observer_->updated()); |
159 EXPECT_NEAR(bitrate_observer_->latest_bitrate(), 4000000u, 10000u); | 115 EXPECT_NEAR(bitrate_observer_->latest_bitrate(), 4000000u, 10000u); |
160 } | 116 } |
161 | 117 |
162 TEST_F(DelayBasedBweTest, ProbingIgnoresSmallPackets) { | |
163 int64_t now_ms = clock_.TimeInMilliseconds(); | |
164 uint16_t seq_num = 0; | |
165 // Probing with 200 bytes every 10 ms, should be ignored by the probe | |
166 // detection. | |
167 for (int i = 0; i < kNumProbes; ++i) { | |
168 clock_.AdvanceTimeMilliseconds(10); | |
169 now_ms = clock_.TimeInMilliseconds(); | |
170 IncomingFeedback(now_ms, now_ms, seq_num++, | |
171 PacedSender::kMinProbePacketSize, 1); | |
172 } | |
173 | |
174 EXPECT_FALSE(bitrate_observer_->updated()); | |
175 | |
176 // Followed by a probe with 1000 bytes packets, should be detected as a | |
177 // probe. | |
178 for (int i = 0; i < kNumProbes; ++i) { | |
179 clock_.AdvanceTimeMilliseconds(10); | |
180 now_ms = clock_.TimeInMilliseconds(); | |
181 IncomingFeedback(now_ms, now_ms, seq_num++, 1000, 1); | |
182 } | |
183 | |
184 // Wait long enough so that we can call Process again. | |
185 clock_.AdvanceTimeMilliseconds(1000); | |
186 | |
187 EXPECT_TRUE(bitrate_observer_->updated()); | |
188 EXPECT_NEAR(bitrate_observer_->latest_bitrate(), 800000u, 10000u); | |
189 } | |
190 | |
191 TEST_F(DelayBasedBweTest, InitialBehavior) { | 118 TEST_F(DelayBasedBweTest, InitialBehavior) { |
192 InitialBehaviorTestHelper(674840); | 119 InitialBehaviorTestHelper(674840); |
193 } | 120 } |
194 | 121 |
195 TEST_F(DelayBasedBweTest, RateIncreaseReordering) { | 122 TEST_F(DelayBasedBweTest, RateIncreaseReordering) { |
196 RateIncreaseReorderingTestHelper(674840); | 123 RateIncreaseReorderingTestHelper(674840); |
197 } | 124 } |
198 | 125 |
199 TEST_F(DelayBasedBweTest, RateIncreaseRtpTimestamps) { | 126 TEST_F(DelayBasedBweTest, RateIncreaseRtpTimestamps) { |
200 RateIncreaseRtpTimestampsTestHelper(1240); | 127 RateIncreaseRtpTimestampsTestHelper(1240); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 175 } |
249 | 176 |
250 TEST_F(DelayBasedBweTest, TestLongTimeoutAndWrap) { | 177 TEST_F(DelayBasedBweTest, TestLongTimeoutAndWrap) { |
251 // 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 |
252 // 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 |
253 // 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 |
254 // properly timed out. | 181 // properly timed out. |
255 TestWrappingHelper(10 * 64); | 182 TestWrappingHelper(10 * 64); |
256 } | 183 } |
257 } // namespace webrtc | 184 } // namespace webrtc |
OLD | NEW |