| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 187 } |
| 188 | 188 |
| 189 TEST_F(DelayBasedBweTest, TestLongTimeoutAndWrap) { | 189 TEST_F(DelayBasedBweTest, TestLongTimeoutAndWrap) { |
| 190 // Simulate a client leaving and rejoining the call after some multiple of | 190 // Simulate a client leaving and rejoining the call after some multiple of |
| 191 // 64 seconds later. This will cause a zero difference in abs send times due | 191 // 64 seconds later. This will cause a zero difference in abs send times due |
| 192 // to the wrap, but a big difference in arrival time, if streams aren't | 192 // to the wrap, but a big difference in arrival time, if streams aren't |
| 193 // properly timed out. | 193 // properly timed out. |
| 194 TestWrappingHelper(10 * 64); | 194 TestWrappingHelper(10 * 64); |
| 195 } | 195 } |
| 196 | 196 |
| 197 TEST_F(DelayBasedBweTest, TestInitialOveruse) { |
| 198 const uint32_t kStartBitrate = 300e3; |
| 199 const uint32_t kInitialCapacityBps = 200e3; |
| 200 const uint32_t kDummySsrc = 0; |
| 201 // High FPS to ensure that we send a lot of packets in a short time. |
| 202 const int kFps = 90; |
| 203 |
| 204 stream_generator_->AddStream(new test::RtpStream(kFps, kStartBitrate)); |
| 205 stream_generator_->set_capacity_bps(kInitialCapacityBps); |
| 206 |
| 207 // Needed to initialize the AimdRateControl. |
| 208 bitrate_estimator_->SetStartBitrate(kStartBitrate); |
| 209 |
| 210 // Produce 30 frames (in 1/3 second) and give them to the estimator. |
| 211 uint32_t bitrate_bps = kStartBitrate; |
| 212 bool seen_overuse = false; |
| 213 for (int i = 0; i < 30; ++i) { |
| 214 bool overuse = GenerateAndProcessFrame(kDummySsrc, bitrate_bps); |
| 215 // The purpose of this test is to ensure that we back down even if we don't |
| 216 // have any acknowledged bitrate estimate yet. Hence, if the test works |
| 217 // as expected, we should not have a measured bitrate yet. |
| 218 EXPECT_FALSE(acknowledged_bitrate_estimator_->bitrate_bps().has_value()); |
| 219 if (overuse) { |
| 220 EXPECT_TRUE(bitrate_observer_.updated()); |
| 221 EXPECT_NEAR(bitrate_observer_.latest_bitrate(), kStartBitrate / 2, 15000); |
| 222 bitrate_bps = bitrate_observer_.latest_bitrate(); |
| 223 seen_overuse = true; |
| 224 break; |
| 225 } else if (bitrate_observer_.updated()) { |
| 226 bitrate_bps = bitrate_observer_.latest_bitrate(); |
| 227 bitrate_observer_.Reset(); |
| 228 } |
| 229 } |
| 230 EXPECT_TRUE(seen_overuse); |
| 231 EXPECT_NEAR(bitrate_observer_.latest_bitrate(), kStartBitrate / 2, 15000); |
| 232 } |
| 233 |
| 197 } // namespace webrtc | 234 } // namespace webrtc |
| OLD | NEW |