From 9b1700cfaef90529f61da54a4f0676928f7dd2c5 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Mon, 5 Aug 2019 17:12:20 +0200 Subject: [PATCH] Enable field trial LegacySimulcastLayerLimit by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using simulcast, if the source is too small, it might end up generating layer sizes that are problematic for hardware encoders. We can temporarily restore the old behavior that adapts the layer count to the source size until we fix the HW encoder behavior. to fix HW encoder issues Bug: webrtc:10849, chromium:990823 Change-Id: Ie1486c9209b408c797c92d1b319d4116fe77171b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/148069 Commit-Queue: Florent Castelli Reviewed-by: Erik Språng Cr-Commit-Position: refs/heads/master@{#28761} --- media/engine/simulcast.cc | 3 ++- media/engine/simulcast_unittest.cc | 16 +++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/media/engine/simulcast.cc b/media/engine/simulcast.cc index 5b62e52dbc..b7db9bc2c1 100644 --- a/media/engine/simulcast.cc +++ b/media/engine/simulcast.cc @@ -183,7 +183,8 @@ int GetTotalMaxBitrateBps(const std::vector& layers) { } int LimitSimulcastLayerCount(int width, int height, int layer_count) { - if (webrtc::field_trial::IsEnabled(kUseLegacySimulcastLayerLimitFieldTrial)) { + if (!webrtc::field_trial::IsDisabled( + kUseLegacySimulcastLayerLimitFieldTrial)) { int adaptive_layer_count = kSimulcastFormats[FindSimulcastFormatIndex(width, height)].max_layers; if (layer_count > adaptive_layer_count) { diff --git a/media/engine/simulcast_unittest.cc b/media/engine/simulcast_unittest.cc index d16eab1268..402a556ac6 100644 --- a/media/engine/simulcast_unittest.cc +++ b/media/engine/simulcast_unittest.cc @@ -140,20 +140,22 @@ TEST(SimulcastTest, GetConfigWithLimitedMaxLayers) { } TEST(SimulcastTest, GetConfigWithLimitedMaxLayersForResolution) { + test::ScopedFieldTrials field_trials( + "WebRTC-LegacySimulcastLayerLimit/Enabled/"); const size_t kMaxLayers = 3; std::vector streams = cricket::GetSimulcastConfig( kMaxLayers, 800, 600, kBitratePriority, kQpMax, !kScreenshare); - EXPECT_EQ(3u, streams.size()); - EXPECT_EQ(200u, streams[0].width); - EXPECT_EQ(150u, streams[0].height); - EXPECT_EQ(400u, streams[1].width); - EXPECT_EQ(300u, streams[1].height); - EXPECT_EQ(800u, streams[2].width); - EXPECT_EQ(600u, streams[2].height); + EXPECT_EQ(2u, streams.size()); + EXPECT_EQ(400u, streams[0].width); + EXPECT_EQ(300u, streams[0].height); + EXPECT_EQ(800u, streams[1].width); + EXPECT_EQ(600u, streams[1].height); } TEST(SimulcastTest, GetConfigWithNotLimitedMaxLayersForResolution) { + test::ScopedFieldTrials field_trials( + "WebRTC-LegacySimulcastLayerLimit/Disabled/"); const size_t kMaxLayers = 3; std::vector streams = cricket::GetSimulcastConfig( kMaxLayers, 800, 600, kBitratePriority, kQpMax, !kScreenshare);