Fill fps allocation by LibaomAv1Encoder::GetEncoderInfo

Absent fps allocation imply single layer stream which confuses bitrate adjuster.
As a result bitrate adjuster turned off S0T1 and S0T2 layers for the L3T3 structure.

Bug: webrtc:12148
Change-Id: I5b3a7b44322f347f41dd8858b3d703827e69dd72
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/201384
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32952}
This commit is contained in:
Danil Chapovalov
2021-01-12 14:45:07 +01:00
committed by Commit Bot
parent 6f597bd2ab
commit b942d45110
2 changed files with 26 additions and 0 deletions

View File

@ -663,6 +663,15 @@ VideoEncoder::EncoderInfo LibaomAv1Encoder::GetEncoderInfo() const {
info.is_hardware_accelerated = false;
info.scaling_settings = VideoEncoder::ScalingSettings(kMinQindex, kMaxQindex);
info.preferred_pixel_formats = {VideoFrameBuffer::Type::kI420};
if (SvcEnabled()) {
for (int sid = 0; sid < svc_params_->number_spatial_layers; ++sid) {
info.fps_allocation[sid].resize(svc_params_->number_temporal_layers);
for (int tid = 0; tid < svc_params_->number_temporal_layers; ++tid) {
info.fps_allocation[sid][tid] =
encoder_settings_.maxFramerate / svc_params_->framerate_factor[tid];
}
}
}
return info;
}

View File

@ -25,6 +25,8 @@
namespace webrtc {
namespace {
using ::testing::ElementsAre;
using ::testing::IsEmpty;
using ::testing::SizeIs;
VideoCodec DefaultCodecSettings() {
@ -102,5 +104,20 @@ TEST(LibaomAv1EncoderTest, SetsEndOfPictureForLastFrameInTemporalUnit) {
EXPECT_TRUE(encoded_frames[5].codec_specific_info.end_of_picture);
}
TEST(LibaomAv1EncoderTest, EncoderInfoProvidesFpsAllocation) {
std::unique_ptr<VideoEncoder> encoder = CreateLibaomAv1Encoder();
VideoCodec codec_settings = DefaultCodecSettings();
codec_settings.SetScalabilityMode("L3T3");
codec_settings.maxFramerate = 60;
ASSERT_EQ(encoder->InitEncode(&codec_settings, DefaultEncoderSettings()),
WEBRTC_VIDEO_CODEC_OK);
const auto& encoder_info = encoder->GetEncoderInfo();
EXPECT_THAT(encoder_info.fps_allocation[0], ElementsAre(15, 30, 60));
EXPECT_THAT(encoder_info.fps_allocation[1], ElementsAre(15, 30, 60));
EXPECT_THAT(encoder_info.fps_allocation[2], ElementsAre(15, 30, 60));
EXPECT_THAT(encoder_info.fps_allocation[3], IsEmpty());
}
} // namespace
} // namespace webrtc