diff --git a/media/engine/simulcast.cc b/media/engine/simulcast.cc index 656645c0be..b8e7a6caa5 100644 --- a/media/engine/simulcast.cc +++ b/media/engine/simulcast.cc @@ -233,15 +233,15 @@ std::vector GetSimulcastConfig( bool temporal_layers_supported) { RTC_DCHECK(max_layers > 1 || is_screenshare_with_conference_mode); - // Some applications rely on the old behavior limiting the simulcast layer - // count based on the resolution automatically, which they can get through - // the WebRTC-LegacySimulcastLayerLimit field trial until they update. - max_layers = LimitSimulcastLayerCount(width, height, max_layers); - if (is_screenshare_with_conference_mode) { return GetScreenshareLayers(max_layers, width, height, bitrate_priority, max_qp, temporal_layers_supported); } else { + // Some applications rely on the old behavior limiting the simulcast layer + // count based on the resolution automatically, which they can get through + // the WebRTC-LegacySimulcastLayerLimit field trial until they update. + max_layers = LimitSimulcastLayerCount(width, height, max_layers); + return GetNormalSimulcastLayers(max_layers, width, height, bitrate_priority, max_qp, temporal_layers_supported); } diff --git a/media/engine/simulcast_unittest.cc b/media/engine/simulcast_unittest.cc index 27b0913429..9e17a8928b 100644 --- a/media/engine/simulcast_unittest.cc +++ b/media/engine/simulcast_unittest.cc @@ -153,6 +153,18 @@ TEST(SimulcastTest, GetConfigWithLimitedMaxLayersForResolution) { EXPECT_EQ(600u, streams[1].height); } +TEST(SimulcastTest, GetConfigWithLowResolutionScreenshare) { + test::ScopedFieldTrials field_trials( + "WebRTC-LegacySimulcastLayerLimit/Enabled/"); + const size_t kMaxLayers = 3; + std::vector streams = cricket::GetSimulcastConfig( + kMaxLayers, 100, 100, kBitratePriority, kQpMax, kScreenshare); + + // Simulcast streams number is never decreased for screenshare, + // even for very low resolution. + EXPECT_GT(streams.size(), 1u); +} + TEST(SimulcastTest, GetConfigWithNotLimitedMaxLayersForResolution) { test::ScopedFieldTrials field_trials( "WebRTC-LegacySimulcastLayerLimit/Disabled/");