Chromium Code Reviews| 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 for (int i = 0; i < 30; ++i) { | |
| 213 bool overuse = GenerateAndProcessFrame(kDummySsrc, bitrate_bps); | |
| 214 // The purpose of this test is to ensure that we back down even if we don't | |
| 215 // have any acknowledged bitrate estimate yet. Hence, if the test works | |
| 216 // as expected, we should not have a measured bitrate yet. | |
| 217 EXPECT_FALSE(acknowledged_bitrate_estimator_->bitrate_bps().has_value()); | |
| 218 if (overuse) { | |
| 219 EXPECT_TRUE(bitrate_observer_.updated()); | |
| 220 EXPECT_NEAR(bitrate_observer_.latest_bitrate(), kStartBitrate / 2, 15000); | |
| 221 bitrate_bps = bitrate_observer_.latest_bitrate(); | |
| 222 break; | |
| 223 } else if (bitrate_observer_.updated()) { | |
| 224 bitrate_bps = bitrate_observer_.latest_bitrate(); | |
| 225 bitrate_observer_.Reset(); | |
| 226 } | |
| 227 } | |
| 228 EXPECT_NEAR(bitrate_observer_.latest_bitrate(), kStartBitrate / 2, 15000); | |
|
holmer
2017/07/04 10:54:30
Should we add an EXPECT_TRUE(seen_overuse)?
terelius
2017/07/04 11:01:12
Done.
| |
| 229 } | |
| 230 | |
| 197 } // namespace webrtc | 231 } // namespace webrtc |
| OLD | NEW |