| 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 bitrate_sum += bitrate; | 404 bitrate_sum += bitrate; |
| 405 } | 405 } |
| 406 ASSERT_EQ(bitrate_sum, kStartBitrate); | 406 ASSERT_EQ(bitrate_sum, kStartBitrate); |
| 407 } | 407 } |
| 408 | 408 |
| 409 // Run in steady state to make the estimator converge. | 409 // Run in steady state to make the estimator converge. |
| 410 stream_generator_->set_capacity_bps(kInitialCapacityBps); | 410 stream_generator_->set_capacity_bps(kInitialCapacityBps); |
| 411 uint32_t bitrate_bps = SteadyStateRun( | 411 uint32_t bitrate_bps = SteadyStateRun( |
| 412 kDefaultSsrc, steady_state_time * kFramerate, kStartBitrate, | 412 kDefaultSsrc, steady_state_time * kFramerate, kStartBitrate, |
| 413 kMinExpectedBitrate, kMaxExpectedBitrate, kInitialCapacityBps); | 413 kMinExpectedBitrate, kMaxExpectedBitrate, kInitialCapacityBps); |
| 414 EXPECT_NEAR(kInitialCapacityBps, bitrate_bps, 130000u); | 414 EXPECT_NEAR(kInitialCapacityBps, bitrate_bps, 180000u); |
| 415 bitrate_observer_.Reset(); | 415 bitrate_observer_.Reset(); |
| 416 | 416 |
| 417 // Add an offset to make sure the BWE can handle it. | 417 // Add an offset to make sure the BWE can handle it. |
| 418 arrival_time_offset_ms_ += receiver_clock_offset_change_ms; | 418 arrival_time_offset_ms_ += receiver_clock_offset_change_ms; |
| 419 | 419 |
| 420 // Reduce the capacity and verify the decrease time. | 420 // Reduce the capacity and verify the decrease time. |
| 421 stream_generator_->set_capacity_bps(kReducedCapacityBps); | 421 stream_generator_->set_capacity_bps(kReducedCapacityBps); |
| 422 int64_t overuse_start_time = clock_.TimeInMilliseconds(); | 422 int64_t overuse_start_time = clock_.TimeInMilliseconds(); |
| 423 int64_t bitrate_drop_time = -1; | 423 int64_t bitrate_drop_time = -1; |
| 424 for (int i = 0; i < 100 * number_of_streams; ++i) { | 424 for (int i = 0; i < 100 * number_of_streams; ++i) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 clock_.AdvanceTimeMilliseconds(kFrameIntervalMs); | 485 clock_.AdvanceTimeMilliseconds(kFrameIntervalMs); |
| 486 send_time_ms += kFrameIntervalMs; | 486 send_time_ms += kFrameIntervalMs; |
| 487 } | 487 } |
| 488 uint32_t bitrate_before = 0; | 488 uint32_t bitrate_before = 0; |
| 489 std::vector<uint32_t> ssrcs; | 489 std::vector<uint32_t> ssrcs; |
| 490 bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_before); | 490 bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_before); |
| 491 | 491 |
| 492 clock_.AdvanceTimeMilliseconds(silence_time_s * 1000); | 492 clock_.AdvanceTimeMilliseconds(silence_time_s * 1000); |
| 493 send_time_ms += silence_time_s * 1000; | 493 send_time_ms += silence_time_s * 1000; |
| 494 | 494 |
| 495 for (size_t i = 0; i < 22; ++i) { | 495 for (size_t i = 0; i < 23; ++i) { |
| 496 IncomingFeedback(clock_.TimeInMilliseconds(), send_time_ms, | 496 IncomingFeedback(clock_.TimeInMilliseconds(), send_time_ms, |
| 497 sequence_number++, 1000); | 497 sequence_number++, 1000); |
| 498 clock_.AdvanceTimeMilliseconds(2 * kFrameIntervalMs); | 498 clock_.AdvanceTimeMilliseconds(2 * kFrameIntervalMs); |
| 499 send_time_ms += kFrameIntervalMs; | 499 send_time_ms += kFrameIntervalMs; |
| 500 } | 500 } |
| 501 uint32_t bitrate_after = 0; | 501 uint32_t bitrate_after = 0; |
| 502 bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_after); | 502 bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_after); |
| 503 EXPECT_LT(bitrate_after, bitrate_before); | 503 EXPECT_LT(bitrate_after, bitrate_before); |
| 504 } | 504 } |
| 505 } // namespace webrtc | 505 } // namespace webrtc |
| OLD | NEW |