| Index: webrtc/video/vie_encoder_unittest.cc
|
| diff --git a/webrtc/video/vie_encoder_unittest.cc b/webrtc/video/vie_encoder_unittest.cc
|
| index 8c57d885be3193234935d85707a2813c4ddd8e7b..ec129cac3a69f87febedf7176c6d707029f3f38a 100644
|
| --- a/webrtc/video/vie_encoder_unittest.cc
|
| +++ b/webrtc/video/vie_encoder_unittest.cc
|
| @@ -1659,4 +1659,52 @@ TEST_F(ViEEncoderTest, DoesntAdaptDownPastMinFramerate) {
|
| }
|
| vie_encoder_->Stop();
|
| }
|
| +
|
| +TEST_F(ViEEncoderTest, PriodicallyUpdatesChannelParameters) {
|
| + const int kFrameWidth = 1280;
|
| + const int kFrameHeight = 720;
|
| + const int kLowFps = 2;
|
| + const int kHighFps = 30;
|
| +
|
| + rtc::ScopedFakeClock fake_clock;
|
| + vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
|
| +
|
| + int64_t timestamp_ms = 1000;
|
| +
|
| + // Insert 2 seconds of 2fps video.
|
| + for (int i = 0; i < kLowFps * 2; ++i) {
|
| + video_source_.IncomingCapturedFrame(
|
| + CreateFrame(timestamp_ms, kFrameWidth, kFrameHeight));
|
| + sink_.WaitForEncodedFrame(timestamp_ms);
|
| + timestamp_ms += 1000 / kLowFps;
|
| + fake_clock.AdvanceTimeMicros((1000 / kLowFps) * 1000);
|
| + }
|
| +
|
| + // Make sure encoder is updated with new target.
|
| + vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
|
| + video_source_.IncomingCapturedFrame(
|
| + CreateFrame(timestamp_ms, kFrameWidth, kFrameHeight));
|
| + sink_.WaitForEncodedFrame(timestamp_ms);
|
| + timestamp_ms += 1000 / kLowFps;
|
| + fake_clock.AdvanceTimeMicros((1000 / kLowFps) * 1000);
|
| +
|
| + EXPECT_EQ(kLowFps, fake_encoder_.GetConfiguredInputFramerate());
|
| +
|
| + // Insert 30fps frames for just a little more than the forced update period.
|
| + const int kVcmTimerIntervalFrames =
|
| + (vcm::VCMProcessTimer::kDefaultProcessIntervalMs * kHighFps) / 1000;
|
| + for (int i = 0; i < kVcmTimerIntervalFrames + 2; ++i) {
|
| + video_source_.IncomingCapturedFrame(
|
| + CreateFrame(timestamp_ms, kFrameWidth, kFrameHeight));
|
| + sink_.WaitForEncodedFrame(timestamp_ms);
|
| + timestamp_ms += 1000 / kHighFps;
|
| + fake_clock.AdvanceTimeMicros((1000 / kHighFps) * 1000);
|
| + }
|
| +
|
| + // Don expect correct measurement just yet, but it should be higher than
|
| + // before.
|
| + EXPECT_GT(fake_encoder_.GetConfiguredInputFramerate(), kLowFps);
|
| +
|
| + vie_encoder_->Stop();
|
| +}
|
| } // namespace webrtc
|
|
|