| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 EXPECT_TRUE(bitrate_update_seen); | 259 EXPECT_TRUE(bitrate_update_seen); |
| 260 return bitrate_bps; | 260 return bitrate_bps; |
| 261 } | 261 } |
| 262 | 262 |
| 263 void DelayBasedBweTest::InitialBehaviorTestHelper( | 263 void DelayBasedBweTest::InitialBehaviorTestHelper( |
| 264 uint32_t expected_converge_bitrate) { | 264 uint32_t expected_converge_bitrate) { |
| 265 const int kFramerate = 50; // 50 fps to avoid rounding errors. | 265 const int kFramerate = 50; // 50 fps to avoid rounding errors. |
| 266 const int kFrameIntervalMs = 1000 / kFramerate; | 266 const int kFrameIntervalMs = 1000 / kFramerate; |
| 267 const PacedPacketInfo kPacingInfo(0, 1, 100); | 267 const PacedPacketInfo kPacingInfo(0, 5, 5000); |
| 268 uint32_t bitrate_bps = 0; | 268 uint32_t bitrate_bps = 0; |
| 269 int64_t send_time_ms = 0; | 269 int64_t send_time_ms = 0; |
| 270 uint16_t sequence_number = 0; | 270 uint16_t sequence_number = 0; |
| 271 std::vector<uint32_t> ssrcs; | 271 std::vector<uint32_t> ssrcs; |
| 272 EXPECT_FALSE(bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_bps)); | 272 EXPECT_FALSE(bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_bps)); |
| 273 EXPECT_EQ(0u, ssrcs.size()); | 273 EXPECT_EQ(0u, ssrcs.size()); |
| 274 clock_.AdvanceTimeMilliseconds(1000); | 274 clock_.AdvanceTimeMilliseconds(1000); |
| 275 EXPECT_FALSE(bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_bps)); | 275 EXPECT_FALSE(bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_bps)); |
| 276 EXPECT_FALSE(bitrate_observer_.updated()); | 276 EXPECT_FALSE(bitrate_observer_.updated()); |
| 277 bitrate_observer_.Reset(); | 277 bitrate_observer_.Reset(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 300 EXPECT_NEAR(expected_converge_bitrate, bitrate_bps, kAcceptedBitrateErrorBps); | 300 EXPECT_NEAR(expected_converge_bitrate, bitrate_bps, kAcceptedBitrateErrorBps); |
| 301 EXPECT_TRUE(bitrate_observer_.updated()); | 301 EXPECT_TRUE(bitrate_observer_.updated()); |
| 302 bitrate_observer_.Reset(); | 302 bitrate_observer_.Reset(); |
| 303 EXPECT_EQ(bitrate_observer_.latest_bitrate(), bitrate_bps); | 303 EXPECT_EQ(bitrate_observer_.latest_bitrate(), bitrate_bps); |
| 304 } | 304 } |
| 305 | 305 |
| 306 void DelayBasedBweTest::RateIncreaseReorderingTestHelper( | 306 void DelayBasedBweTest::RateIncreaseReorderingTestHelper( |
| 307 uint32_t expected_bitrate_bps) { | 307 uint32_t expected_bitrate_bps) { |
| 308 const int kFramerate = 50; // 50 fps to avoid rounding errors. | 308 const int kFramerate = 50; // 50 fps to avoid rounding errors. |
| 309 const int kFrameIntervalMs = 1000 / kFramerate; | 309 const int kFrameIntervalMs = 1000 / kFramerate; |
| 310 const PacedPacketInfo kPacingInfo(0, 1, 100); | 310 const PacedPacketInfo kPacingInfo(0, 5, 5000); |
| 311 int64_t send_time_ms = 0; | 311 int64_t send_time_ms = 0; |
| 312 uint16_t sequence_number = 0; | 312 uint16_t sequence_number = 0; |
| 313 // Inserting packets for five seconds to get a valid estimate. | 313 // Inserting packets for five seconds to get a valid estimate. |
| 314 for (int i = 0; i < 5 * kFramerate + 1 + kNumInitialPackets; ++i) { | 314 for (int i = 0; i < 5 * kFramerate + 1 + kNumInitialPackets; ++i) { |
| 315 // NOTE!!! If the following line is moved under the if case then this test | 315 // NOTE!!! If the following line is moved under the if case then this test |
| 316 // wont work on windows realease bots. | 316 // wont work on windows realease bots. |
| 317 PacedPacketInfo pacing_info = | 317 PacedPacketInfo pacing_info = |
| 318 i < kInitialProbingPackets ? kPacingInfo : PacedPacketInfo(); | 318 i < kInitialProbingPackets ? kPacingInfo : PacedPacketInfo(); |
| 319 | 319 |
| 320 // TODO(sprang): Remove this hack once the single stream estimator is gone, | 320 // TODO(sprang): Remove this hack once the single stream estimator is gone, |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |