SimulcastEncoderAdapter should not update maxQp for screencast

Bug: webrtc:9608
Change-Id: I70f10c77df6579a24678842a9d9e7a2a528b0c40
Reviewed-on: https://webrtc-review.googlesource.com/93287
Commit-Queue: Erik Språng <sprang@webrtc.org>
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24241}
This commit is contained in:
Erik Språng 2018-08-09 11:18:17 +02:00 committed by Commit Bot
parent 43a6d2bbf8
commit 8d2995b865
2 changed files with 32 additions and 1 deletions

View File

@ -463,7 +463,7 @@ void SimulcastEncoderAdapter::PopulateStreamCodec(
stream_codec->qpMax = inst.simulcastStream[stream_index].qpMax;
// Settings that are based on stream/resolution.
const bool lowest_resolution_stream = (stream_index == 0);
if (lowest_resolution_stream) {
if (lowest_resolution_stream && inst.mode != VideoCodecMode::kScreensharing) {
// Settings for lowest spatial resolutions.
stream_codec->qpMax = kLowestResMaxQp;
}

View File

@ -872,5 +872,36 @@ TEST_F(TestSimulcastEncoderAdapterFake, TestInitFailureCleansUpEncoders) {
EXPECT_TRUE(helper_->factory()->encoders().empty());
}
TEST_F(TestSimulcastEncoderAdapterFake, DoesNotAlterMaxQpForScreenshare) {
const int kHighMaxQp = 56;
const int kLowMaxQp = 46;
SimulcastTestFixtureImpl::DefaultSettings(
&codec_, static_cast<const int*>(kTestTemporalLayerProfile),
kVideoCodecVP8);
codec_.numberOfSimulcastStreams = 3;
codec_.simulcastStream[0].qpMax = kHighMaxQp;
codec_.mode = VideoCodecMode::kScreensharing;
EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200));
EXPECT_EQ(3u, helper_->factory()->encoders().size());
// Just check the lowest stream, which is the one that where the adapter
// might alter the max qp setting.
VideoCodec ref_codec;
InitRefCodec(0, &ref_codec);
ref_codec.qpMax = kHighMaxQp;
ref_codec.VP8()->complexity = webrtc::VideoCodecComplexity::kComplexityHigher;
ref_codec.VP8()->denoisingOn = false;
ref_codec.startBitrate = 100; // Should equal to the target bitrate.
VerifyCodec(ref_codec, 0);
// Change the max qp and try again.
codec_.simulcastStream[0].qpMax = kLowMaxQp;
EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200));
EXPECT_EQ(3u, helper_->factory()->encoders().size());
ref_codec.qpMax = kLowMaxQp;
VerifyCodec(ref_codec, 0);
}
} // namespace test
} // namespace webrtc