Add test to cover bug in vp9 wrapper, triggered by field trial

This CL adds test coverage for the following fix:
https://webrtc-review.googlesource.com/c/src/+/138076

Bug: webrtc:10155, b:133399415
Change-Id: I4a680ad493f448f8565b570d09d3eb60a744325b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138260
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28061}
This commit is contained in:
Erik Språng
2019-05-24 13:48:34 +02:00
committed by Commit Bot
parent 4b27648d8b
commit 4c29546e15

View File

@ -1344,4 +1344,31 @@ TEST_F(TestVp9ImplProfile2, EncodeDecode) {
31);
}
TEST_F(TestVp9Impl, EncodeWithDynamicRate) {
// Configured dynamic rate field trial and re-create the encoder.
test::ScopedFieldTrials field_trials(
"WebRTC-VideoRateControl/vp9_dynamic_rate:true/");
SetUp();
// Set 300kbps target with 100% headroom.
VideoEncoder::RateControlParameters params;
params.bandwidth_allocation = DataRate::bps(300000);
params.bitrate.SetBitrate(0, 0, params.bandwidth_allocation.bps());
params.framerate_fps = 30.0;
encoder_->SetRates(params);
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
encoder_->Encode(*NextInputFrame(), nullptr));
EncodedImage encoded_frame;
CodecSpecificInfo codec_specific_info;
ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
// Set no headroom and encode again.
params.bandwidth_allocation = DataRate::Zero();
encoder_->SetRates(params);
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
encoder_->Encode(*NextInputFrame(), nullptr));
ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
}
} // namespace webrtc