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 #include "webrtc/modules/congestion_controller/delay_based_bwe_unittest_helper.h " | 10 #include "webrtc/modules/congestion_controller/delay_based_bwe_unittest_helper.h " |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 349 // bitrate(i) = 1.04 * bitrate(i-1) + 1000 | 349 // bitrate(i) = 1.04 * bitrate(i-1) + 1000 |
| 350 // until bitrate(i) > 500000, with bitrate(1) ~= 30000. | 350 // until bitrate(i) > 500000, with bitrate(1) ~= 30000. |
| 351 uint32_t bitrate_bps = 30000; | 351 uint32_t bitrate_bps = 30000; |
| 352 int iterations = 0; | 352 int iterations = 0; |
| 353 AddDefaultStream(); | 353 AddDefaultStream(); |
| 354 // Feed the estimator with a stream of packets and verify that it reaches | 354 // Feed the estimator with a stream of packets and verify that it reaches |
| 355 // 500 kbps at the expected time. | 355 // 500 kbps at the expected time. |
| 356 while (bitrate_bps < 5e5) { | 356 while (bitrate_bps < 5e5) { |
| 357 bool overuse = GenerateAndProcessFrame(kDefaultSsrc, bitrate_bps); | 357 bool overuse = GenerateAndProcessFrame(kDefaultSsrc, bitrate_bps); |
| 358 if (overuse) { | 358 if (overuse) { |
| 359 EXPECT_GT(bitrate_observer_.latest_bitrate(), bitrate_bps); | 359 EXPECT_LT(bitrate_observer_.latest_bitrate(), bitrate_bps); |
|
stefan-webrtc
2016/10/26 15:19:20
I don't really understand this expectation. I also
| |
| 360 bitrate_bps = bitrate_observer_.latest_bitrate(); | 360 bitrate_bps = bitrate_observer_.latest_bitrate(); |
| 361 bitrate_observer_.Reset(); | 361 bitrate_observer_.Reset(); |
| 362 } else if (bitrate_observer_.updated()) { | 362 } else if (bitrate_observer_.updated()) { |
| 363 bitrate_bps = bitrate_observer_.latest_bitrate(); | 363 bitrate_bps = bitrate_observer_.latest_bitrate(); |
| 364 bitrate_observer_.Reset(); | 364 bitrate_observer_.Reset(); |
| 365 } | 365 } |
| 366 ++iterations; | 366 ++iterations; |
| 367 // ASSERT_LE(iterations, expected_iterations); | 367 // ASSERT_LE(iterations, expected_iterations); |
| 368 } | 368 } |
| 369 ASSERT_EQ(expected_iterations, iterations); | 369 ASSERT_EQ(expected_iterations, iterations); |
| 370 } | 370 } |
| 371 | 371 |
| 372 void DelayBasedBweTest::CapacityDropTestHelper( | 372 void DelayBasedBweTest::CapacityDropTestHelper( |
| 373 int number_of_streams, | 373 int number_of_streams, |
| 374 bool wrap_time_stamp, | 374 bool wrap_time_stamp, |
| 375 uint32_t expected_bitrate_drop_delta, | 375 uint32_t expected_bitrate_drop_delta, |
| 376 int64_t receiver_clock_offset_change_ms) { | 376 int64_t receiver_clock_offset_change_ms) { |
| 377 const int kFramerate = 30; | 377 const int kFramerate = 50; |
|
stefan-webrtc
2016/10/26 15:19:20
Could you comment on this change?
| |
| 378 const int kStartBitrate = 900e3; | 378 const int kStartBitrate = 900e3; |
| 379 const int kMinExpectedBitrate = 800e3; | 379 const int kMinExpectedBitrate = 800e3; |
| 380 const int kMaxExpectedBitrate = 1100e3; | 380 const int kMaxExpectedBitrate = 1100e3; |
| 381 const uint32_t kInitialCapacityBps = 1000e3; | 381 const uint32_t kInitialCapacityBps = 1000e3; |
| 382 const uint32_t kReducedCapacityBps = 500e3; | 382 const uint32_t kReducedCapacityBps = 500e3; |
| 383 | 383 |
| 384 int steady_state_time = 0; | 384 int steady_state_time = 0; |
| 385 if (number_of_streams <= 1) { | 385 if (number_of_streams <= 1) { |
| 386 steady_state_time = 10; | 386 steady_state_time = 10; |
| 387 AddDefaultStream(); | 387 AddDefaultStream(); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 400 bitrate_sum += bitrate; | 400 bitrate_sum += bitrate; |
| 401 } | 401 } |
| 402 ASSERT_EQ(bitrate_sum, kStartBitrate); | 402 ASSERT_EQ(bitrate_sum, kStartBitrate); |
| 403 } | 403 } |
| 404 | 404 |
| 405 // Run in steady state to make the estimator converge. | 405 // Run in steady state to make the estimator converge. |
| 406 stream_generator_->set_capacity_bps(kInitialCapacityBps); | 406 stream_generator_->set_capacity_bps(kInitialCapacityBps); |
| 407 uint32_t bitrate_bps = SteadyStateRun( | 407 uint32_t bitrate_bps = SteadyStateRun( |
| 408 kDefaultSsrc, steady_state_time * kFramerate, kStartBitrate, | 408 kDefaultSsrc, steady_state_time * kFramerate, kStartBitrate, |
| 409 kMinExpectedBitrate, kMaxExpectedBitrate, kInitialCapacityBps); | 409 kMinExpectedBitrate, kMaxExpectedBitrate, kInitialCapacityBps); |
| 410 EXPECT_NEAR(kInitialCapacityBps, bitrate_bps, 130000u); | 410 EXPECT_NEAR(kInitialCapacityBps, bitrate_bps, 150000u); |
| 411 bitrate_observer_.Reset(); | 411 bitrate_observer_.Reset(); |
| 412 | 412 |
| 413 // Add an offset to make sure the BWE can handle it. | 413 // Add an offset to make sure the BWE can handle it. |
| 414 arrival_time_offset_ms_ += receiver_clock_offset_change_ms; | 414 arrival_time_offset_ms_ += receiver_clock_offset_change_ms; |
| 415 | 415 |
| 416 // Reduce the capacity and verify the decrease time. | 416 // Reduce the capacity and verify the decrease time. |
| 417 stream_generator_->set_capacity_bps(kReducedCapacityBps); | 417 stream_generator_->set_capacity_bps(kReducedCapacityBps); |
| 418 int64_t overuse_start_time = clock_.TimeInMilliseconds(); | 418 int64_t overuse_start_time = clock_.TimeInMilliseconds(); |
| 419 int64_t bitrate_drop_time = -1; | 419 int64_t bitrate_drop_time = -1; |
| 420 for (int i = 0; i < 100 * number_of_streams; ++i) { | 420 for (int i = 0; i < 100 * number_of_streams; ++i) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 492 IncomingFeedback(clock_.TimeInMilliseconds(), send_time_ms, | 492 IncomingFeedback(clock_.TimeInMilliseconds(), send_time_ms, |
| 493 sequence_number++, 1000); | 493 sequence_number++, 1000); |
| 494 clock_.AdvanceTimeMilliseconds(2 * kFrameIntervalMs); | 494 clock_.AdvanceTimeMilliseconds(2 * kFrameIntervalMs); |
| 495 send_time_ms += kFrameIntervalMs; | 495 send_time_ms += kFrameIntervalMs; |
| 496 } | 496 } |
| 497 uint32_t bitrate_after = 0; | 497 uint32_t bitrate_after = 0; |
| 498 bitrate_estimator_.LatestEstimate(&ssrcs, &bitrate_after); | 498 bitrate_estimator_.LatestEstimate(&ssrcs, &bitrate_after); |
| 499 EXPECT_LT(bitrate_after, bitrate_before); | 499 EXPECT_LT(bitrate_after, bitrate_before); |
| 500 } | 500 } |
| 501 } // namespace webrtc | 501 } // namespace webrtc |
| OLD | NEW |