Restore VideoCodecInitializer to use only the 1st stream maxFramerate
This is a partial fix for regression introduced in
https://webrtc-review.googlesource.com/c/src/+/125461
Currently, the OveruseFrameDetector::OnTargetFramerateUpdated is called
only then the encoder is reconfigured, with the default maxFramerate.
Changing it from default 5 to 60, or even 30 made the detector too
sensitive and it caused adaptation down due to CPU overuse even on
powerful machines.
Bug: webrtc:10310, chromium:940466
Change-Id: I7b0eabfc8f9b502e293af1a5b02fc5d4ab468c14
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/127280
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27094}
diff --git a/modules/video_coding/video_codec_initializer.cc b/modules/video_coding/video_codec_initializer.cc
index 40096e7..3316ce1 100644
--- a/modules/video_coding/video_codec_initializer.cc
+++ b/modules/video_coding/video_codec_initializer.cc
@@ -86,7 +86,6 @@
kDefaultOutlierFrameSizePercent};
RTC_DCHECK_LE(streams.size(), kMaxSimulcastStreams);
- int max_framerate = 0;
for (size_t i = 0; i < streams.size(); ++i) {
SimulcastStream* sim_stream = &video_codec.simulcastStream[i];
RTC_DCHECK_GT(streams[i].width, 0);
@@ -106,7 +105,6 @@
sim_stream->width = static_cast<uint16_t>(streams[i].width);
sim_stream->height = static_cast<uint16_t>(streams[i].height);
sim_stream->maxFramerate = streams[i].max_framerate;
- max_framerate = std::max(max_framerate, streams[i].max_framerate);
sim_stream->minBitrate = streams[i].min_bitrate_bps / 1000;
sim_stream->targetBitrate = streams[i].target_bitrate_bps / 1000;
sim_stream->maxBitrate = streams[i].max_bitrate_bps / 1000;
@@ -136,8 +134,8 @@
if (video_codec.maxBitrate < kEncoderMinBitrateKbps)
video_codec.maxBitrate = kEncoderMinBitrateKbps;
- RTC_DCHECK_GT(max_framerate, 0);
- video_codec.maxFramerate = max_framerate;
+ RTC_DCHECK_GT(streams[0].max_framerate, 0);
+ video_codec.maxFramerate = streams[0].max_framerate;
// Set codec specific options
if (config.encoder_specific_settings)