From 29b4049abc5928d995b51f8614dfb27dc7e3359e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85sa=20Persson?= Date: Wed, 25 Aug 2021 17:58:49 +0200 Subject: [PATCH] VideoStreamEncoder: Remove check for zero VideoCodec.maxBitrate. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit maxBitrate is set to a minimum of kEncoderMinBitrateKbps in VideoCodecInitializer::SetupCodec and cannot be zero at this point. Bug: none Change-Id: I4e062b054d99fabc1a9650260db03dd45b033c3c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/230142 Reviewed-by: Erik Språng Commit-Queue: Åsa Persson Cr-Commit-Position: refs/heads/main@{#35094} --- video/video_stream_encoder.cc | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc index c057882340..8ea6750b87 100644 --- a/video/video_stream_encoder.cc +++ b/video/video_stream_encoder.cc @@ -990,7 +990,6 @@ void VideoStreamEncoder::ReconfigureEncoder() { for (size_t i = 0; i < codec.numberOfSimulcastStreams; ++i) { log_stream << i << ": " << codec.simulcastStream[i].width << "x" << codec.simulcastStream[i].height - << " fps: " << codec.simulcastStream[i].maxFramerate << " min_kbps: " << codec.simulcastStream[i].minBitrate << " target_kbps: " << codec.simulcastStream[i].targetBitrate << " max_kbps: " << codec.simulcastStream[i].maxBitrate @@ -1006,10 +1005,10 @@ void VideoStreamEncoder::ReconfigureEncoder() { for (size_t i = 0; i < num_spatial_layers; ++i) { log_stream << i << ": " << codec.spatialLayers[i].width << "x" << codec.spatialLayers[i].height - << " fps: " << codec.spatialLayers[i].maxFramerate << " min_kbps: " << codec.spatialLayers[i].minBitrate << " target_kbps: " << codec.spatialLayers[i].targetBitrate << " max_kbps: " << codec.spatialLayers[i].maxBitrate + << " max_fps: " << codec.spatialLayers[i].maxFramerate << " max_qp: " << codec.spatialLayers[i].qpMax << " num_tl: " << codec.spatialLayers[i].numberOfTemporalLayers << " active: " @@ -1059,23 +1058,6 @@ void VideoStreamEncoder::ReconfigureEncoder() { } })); - if (codec.maxBitrate == 0) { - // max is one bit per pixel - codec.maxBitrate = - (static_cast(codec.height) * static_cast(codec.width) * - static_cast(codec.maxFramerate)) / - 1000; - if (codec.startBitrate > codec.maxBitrate) { - // But if the user tries to set a higher start bit rate we will - // increase the max accordingly. - codec.maxBitrate = codec.startBitrate; - } - } - - if (codec.startBitrate > codec.maxBitrate) { - codec.startBitrate = codec.maxBitrate; - } - rate_allocator_ = settings_.bitrate_allocator_factory->CreateVideoBitrateAllocator(codec); rate_allocator_->SetLegacyConferenceMode(