Add resolution bitrate thresholds to EncoderInfo.

When provided, these thresholds will be used instead of WebRTC default
limits specified in DropDueToSize() and GetMaxDefaultVideoBitrateKbps().

Bug: none
Change-Id: Ida45ea832041963b8b8475d69114b5c60a172fb7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/142170
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Alex Glaznev <glaznev@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28390}
diff --git a/api/video_codecs/video_encoder.h b/api/video_codecs/video_encoder.h
index d2e4877..5609e93 100644
--- a/api/video_codecs/video_encoder.h
+++ b/api/video_codecs/video_encoder.h
@@ -122,6 +122,26 @@
     ScalingSettings();
   };
 
+  // Bitrate thresholds for resolution.
+  struct ResolutionBitrateThresholds {
+    ResolutionBitrateThresholds(int frame_size_pixels,
+                                int min_start_bitrate_bps,
+                                int min_bitrate_bps,
+                                int max_bitrate_bps)
+        : frame_size_pixels(frame_size_pixels),
+          min_start_bitrate_bps(min_start_bitrate_bps),
+          min_bitrate_bps(min_bitrate_bps),
+          max_bitrate_bps(max_bitrate_bps) {}
+    // Size of video frame, in pixels, the bitrate thresholds are intended for.
+    int frame_size_pixels = 0;
+    // Recommended minimum bitrate to start encoding.
+    int min_start_bitrate_bps = 0;
+    // Recommended minimum bitrate.
+    int min_bitrate_bps = 0;
+    // Recommended maximum bitrate.
+    int max_bitrate_bps = 0;
+  };
+
   // Struct containing metadata about the encoder implementing this interface.
   struct EncoderInfo {
     static constexpr uint8_t kMaxFramerateFraction =
@@ -192,6 +212,9 @@
     // with a 100% frame rate fraction.
     absl::InlinedVector<uint8_t, kMaxTemporalStreams>
         fps_allocation[kMaxSpatialLayers];
+
+    // Recommended bitrate thresholds for different resolutions.
+    std::vector<ResolutionBitrateThresholds> resolution_bitrate_thresholds;
   };
 
   struct RateControlParameters {