From 253fdc305640b6dc66f733faab10728400d57075 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Wed, 19 Aug 2020 14:27:59 +0200 Subject: [PATCH] Don't do legacy conference mode temporal layer allocation on non-screenshare MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some libraries hooking into WebRTC still manage to have the conference mode flag enabled on non screenshare sources resulting in a bad rate allocation. Bug: webrtc:11310 Change-Id: Id5205affb562511eda40c460e380c105d8589c51 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/182003 Reviewed-by: Erik Språng Commit-Queue: Florent Castelli Cr-Commit-Position: refs/heads/master@{#31965} --- modules/video_coding/utility/simulcast_rate_allocator.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/video_coding/utility/simulcast_rate_allocator.cc b/modules/video_coding/utility/simulcast_rate_allocator.cc index 3427676525..39e39abca1 100644 --- a/modules/video_coding/utility/simulcast_rate_allocator.cc +++ b/modules/video_coding/utility/simulcast_rate_allocator.cc @@ -229,7 +229,8 @@ void SimulcastRateAllocator::DistributeAllocationToTemporalLayers( uint32_t max_bitrate_kbps; // Legacy temporal-layered only screenshare, or simulcast screenshare // with legacy mode for simulcast stream 0. - if (legacy_conference_mode_ && simulcast_id == 0) { + if (codec_.mode == VideoCodecMode::kScreensharing && + legacy_conference_mode_ && simulcast_id == 0) { // TODO(holmer): This is a "temporary" hack for screensharing, where we // interpret the startBitrate as the encoder target bitrate. This is // to allow for a different max bitrate, so if the codec can't meet @@ -249,7 +250,8 @@ void SimulcastRateAllocator::DistributeAllocationToTemporalLayers( if (num_temporal_streams == 1) { tl_allocation.push_back(target_bitrate_kbps); } else { - if (legacy_conference_mode_ && simulcast_id == 0) { + if (codec_.mode == VideoCodecMode::kScreensharing && + legacy_conference_mode_ && simulcast_id == 0) { tl_allocation = ScreenshareTemporalLayerAllocation( target_bitrate_kbps, max_bitrate_kbps, simulcast_id); } else {