Set non-zero target bitrate for AV1 single spatial layer case

VideoCodecInitializer::SetupCodec never sets startBitrate,
so SetAv1SvcConfig shouldn't use it.

Bug: webrtc:12720
Change-Id: I04835dc27368f32c19132d93c72364173d7050fc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217382
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33915}
This commit is contained in:
Danil Chapovalov
2021-05-04 13:06:29 +02:00
committed by WebRTC LUCI CQ
parent 5ae6c0da03
commit c27c047e3e
3 changed files with 42 additions and 4 deletions

View File

@ -426,4 +426,39 @@ TEST_F(VideoCodecInitializerTest, Vp9DeactivateLayers) {
EXPECT_FALSE(codec_out_.spatialLayers[2].active);
}
TEST_F(VideoCodecInitializerTest, Av1SingleSpatialLayerBitratesAreConsistent) {
VideoEncoderConfig config;
config.codec_type = VideoCodecType::kVideoCodecAV1;
std::vector<VideoStream> streams = {DefaultStream()};
streams[0].scalability_mode = "L1T2";
VideoCodec codec;
EXPECT_TRUE(VideoCodecInitializer::SetupCodec(config, streams, &codec));
EXPECT_GE(codec.spatialLayers[0].targetBitrate,
codec.spatialLayers[0].minBitrate);
EXPECT_LE(codec.spatialLayers[0].targetBitrate,
codec.spatialLayers[0].maxBitrate);
}
TEST_F(VideoCodecInitializerTest, Av1TwoSpatialLayersBitratesAreConsistent) {
VideoEncoderConfig config;
config.codec_type = VideoCodecType::kVideoCodecAV1;
std::vector<VideoStream> streams = {DefaultStream()};
streams[0].scalability_mode = "L2T2";
VideoCodec codec;
EXPECT_TRUE(VideoCodecInitializer::SetupCodec(config, streams, &codec));
EXPECT_GE(codec.spatialLayers[0].targetBitrate,
codec.spatialLayers[0].minBitrate);
EXPECT_LE(codec.spatialLayers[0].targetBitrate,
codec.spatialLayers[0].maxBitrate);
EXPECT_GE(codec.spatialLayers[1].targetBitrate,
codec.spatialLayers[1].minBitrate);
EXPECT_LE(codec.spatialLayers[1].targetBitrate,
codec.spatialLayers[1].maxBitrate);
}
} // namespace webrtc