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}
diff --git a/modules/video_coding/codecs/av1/libaom_av1_encoder.cc b/modules/video_coding/codecs/av1/libaom_av1_encoder.cc
index 925e41b..a99c642 100644
--- a/modules/video_coding/codecs/av1/libaom_av1_encoder.cc
+++ b/modules/video_coding/codecs/av1/libaom_av1_encoder.cc
@@ -663,6 +663,15 @@
   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;
 }
 
diff --git a/modules/video_coding/codecs/av1/libaom_av1_encoder_unittest.cc b/modules/video_coding/codecs/av1/libaom_av1_encoder_unittest.cc
index 1e457df..146397f 100644
--- a/modules/video_coding/codecs/av1/libaom_av1_encoder_unittest.cc
+++ b/modules/video_coding/codecs/av1/libaom_av1_encoder_unittest.cc
@@ -25,6 +25,8 @@
 namespace webrtc {
 namespace {
 
+using ::testing::ElementsAre;
+using ::testing::IsEmpty;
 using ::testing::SizeIs;
 
 VideoCodec DefaultCodecSettings() {
@@ -102,5 +104,20 @@
   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