Chromium Code Reviews| Index: webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc |
| diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc |
| index f04d9e68c09a53527085cc6ef0f32ac769bad704..67c10c52a9b8a92873cef94469ac72b814ed5729 100644 |
| --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc |
| +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc |
| @@ -18,6 +18,9 @@ namespace webrtc { |
| const size_t kMtu = 1200; |
| const uint32_t kAcceptedBitrateErrorBps = 50000; |
| +// Number of packets needed before we have a valid estimate. |
| +const int kNumInitialPackets = 2; |
| + |
| namespace testing { |
| void TestBitrateObserver::OnReceiveBitrateChanged( |
| @@ -317,16 +320,16 @@ void RemoteBitrateEstimatorTest::InitialBehaviorTestHelper( |
| EXPECT_FALSE(bitrate_observer_->updated()); |
| bitrate_observer_->Reset(); |
| clock_.AdvanceTimeMilliseconds(1000); |
| - // Inserting a packet. Still no valid estimate. We need to wait 5 seconds. |
| - IncomingPacket(kDefaultSsrc, kMtu, clock_.TimeInMilliseconds(), timestamp, |
| - absolute_send_time, true); |
| - bitrate_estimator_->Process(); |
| - EXPECT_FALSE(bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_bps)); |
| - EXPECT_EQ(0u, ssrcs.size()); |
| - EXPECT_FALSE(bitrate_observer_->updated()); |
| - bitrate_observer_->Reset(); |
| // Inserting packets for 5 seconds to get a valid estimate. |
| - for (int i = 0; i < 5 * kFramerate + 1; ++i) { |
| + for (int i = 0; i < 5 * kFramerate + 1 + kNumInitialPackets; ++i) { |
| + if (i == kNumInitialPackets) { |
| + bitrate_estimator_->Process(); |
| + EXPECT_FALSE(bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_bps)); |
| + EXPECT_EQ(0u, ssrcs.size()); |
| + EXPECT_FALSE(bitrate_observer_->updated()); |
| + bitrate_observer_->Reset(); |
| + } |
| + |
| IncomingPacket(kDefaultSsrc, kMtu, clock_.TimeInMilliseconds(), timestamp, |
| absolute_send_time, true); |
| clock_.AdvanceTimeMilliseconds(1000 / kFramerate); |
| @@ -355,12 +358,14 @@ void RemoteBitrateEstimatorTest::RateIncreaseReorderingTestHelper( |
| const uint32_t kFrameIntervalAbsSendTime = AbsSendTime(1, kFramerate); |
| uint32_t timestamp = 0; |
| uint32_t absolute_send_time = 0; |
| - IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), timestamp, |
| - absolute_send_time, true); |
| - bitrate_estimator_->Process(); |
| - EXPECT_FALSE(bitrate_observer_->updated()); // No valid estimate. |
| - // Inserting packets for one second to get a valid estimate. |
| - for (int i = 0; i < 5 * kFramerate + 1; ++i) { |
| + // Inserting packets for five seconds to get a valid estimate. |
| + for (int i = 0; i < 5 * kFramerate + 1 + kNumInitialPackets; ++i) { |
| + if (i == kNumInitialPackets) { |
| + // Process after we have enough frames to get a valid input rate estimate. |
|
stefan-webrtc
2016/06/02 07:16:41
Maybe comment on that this can be removed once the
sprang_webrtc
2016/06/02 08:09:32
Done.
|
| + bitrate_estimator_->Process(); |
| + EXPECT_FALSE(bitrate_observer_->updated()); // No valid estimate. |
| + } |
| + |
| IncomingPacket(kDefaultSsrc, kMtu, clock_.TimeInMilliseconds(), timestamp, |
| absolute_send_time, true); |
| clock_.AdvanceTimeMilliseconds(kFrameIntervalMs); |