Make LAYER_DROP and max_consec_drop=2 to be default settings

Based on the results of the experiment (b/335129329).

Bug: webrtc:15827, b/320629637, b/335129329, chromium:329396373
Change-Id: I1599f4c1be79ee3385aac1ff345168982c8278f8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/360960
Commit-Queue: Erik Språng <sprang@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Auto-Submit: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42895}
diff --git a/experiments/field_trials.py b/experiments/field_trials.py
index 06969eb..c6b6da6 100755
--- a/experiments/field_trials.py
+++ b/experiments/field_trials.py
@@ -98,9 +98,6 @@
     FieldTrial('WebRTC-LibaomAv1Encoder-AdaptiveMaxConsecDrops',
                351644568,
                date(2025, 7, 1)),
-    FieldTrial('WebRTC-LibvpxVp9Encoder-SvcFrameDropConfig',
-               42226190,
-               date(2024, 9, 1)),
     FieldTrial('WebRTC-LibvpxVp8Encoder-AndroidSpecificThreadingSettings',
                42226191,
                date(2024, 9, 1)),
diff --git a/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc b/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc
index fc3640c..7a2b494 100644
--- a/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc
+++ b/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc
@@ -263,8 +263,7 @@
       performance_flags_(ParsePerformanceFlagsFromTrials(env.field_trials())),
       num_steady_state_frames_(0),
       config_changed_(true),
-      encoder_info_override_(env.field_trials()),
-      svc_frame_drop_config_(ParseSvcFrameDropConfig(env.field_trials())) {
+      encoder_info_override_(env.field_trials()) {
   codec_ = {};
   memset(&svc_params_, 0, sizeof(vpx_svc_extra_cfg_t));
 }
@@ -845,8 +844,7 @@
     memset(&svc_drop_frame_, 0, sizeof(svc_drop_frame_));
     const bool reverse_constrained_drop_mode =
         inter_layer_pred_ == InterLayerPredMode::kOn &&
-        codec_.mode == VideoCodecMode::kScreensharing &&
-        num_spatial_layers_ > 1;
+        codec_.mode == VideoCodecMode::kScreensharing;
     if (reverse_constrained_drop_mode) {
       // Screenshare dropping mode: drop a layer only together with all lower
       // layers. This ensures that drops on lower layers won't reduce frame-rate
@@ -857,9 +855,7 @@
         svc_drop_frame_.framedrop_thresh[i] = config_->rc_dropframe_thresh;
       }
     } else {
-      if (svc_frame_drop_config_.enabled &&
-          svc_frame_drop_config_.layer_drop_mode == LAYER_DROP &&
-          is_flexible_mode_ && svc_controller_ &&
+      if (is_flexible_mode_ && svc_controller_ &&
           (inter_layer_pred_ == InterLayerPredMode::kOff ||
            inter_layer_pred_ == InterLayerPredMode::kOnKeyPic)) {
         // SVC controller is required since it properly accounts for dropped
@@ -871,10 +867,7 @@
         // quality flickering and is not compatible with RTP non-flexible mode.
         svc_drop_frame_.framedrop_mode = FULL_SUPERFRAME_DROP;
       }
-      svc_drop_frame_.max_consec_drop =
-          svc_frame_drop_config_.enabled
-              ? svc_frame_drop_config_.max_consec_drop
-              : std::numeric_limits<int>::max();
+      svc_drop_frame_.max_consec_drop = 2;
       for (size_t i = 0; i < num_spatial_layers_; ++i) {
         svc_drop_frame_.framedrop_thresh[i] = config_->rc_dropframe_thresh;
       }
@@ -1846,26 +1839,6 @@
   return config;
 }
 
-LibvpxVp9Encoder::SvcFrameDropConfig LibvpxVp9Encoder::ParseSvcFrameDropConfig(
-    const FieldTrialsView& trials) {
-  FieldTrialFlag enabled = FieldTrialFlag("Enabled");
-  FieldTrialParameter<int> layer_drop_mode("layer_drop_mode",
-                                           FULL_SUPERFRAME_DROP);
-  FieldTrialParameter<int> max_consec_drop("max_consec_drop",
-                                           std::numeric_limits<int>::max());
-  ParseFieldTrial({&enabled, &layer_drop_mode, &max_consec_drop},
-                  trials.Lookup("WebRTC-LibvpxVp9Encoder-SvcFrameDropConfig"));
-  SvcFrameDropConfig config;
-  config.enabled = enabled.Get();
-  config.layer_drop_mode = layer_drop_mode.Get();
-  config.max_consec_drop = max_consec_drop.Get();
-  RTC_LOG(LS_INFO) << "Libvpx VP9 encoder SVC frame drop config: "
-                   << (config.enabled ? "enabled" : "disabled")
-                   << " layer_drop_mode " << config.layer_drop_mode
-                   << " max_consec_drop " << config.max_consec_drop;
-  return config;
-}
-
 void LibvpxVp9Encoder::UpdatePerformanceFlags() {
   flat_map<int, PerformanceFlags::ParameterSet> params_by_resolution;
   if (codec_.GetVideoEncoderComplexity() ==
diff --git a/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.h b/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.h
index 0134e3e..f83fe2d 100644
--- a/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.h
+++ b/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.h
@@ -222,14 +222,6 @@
   bool config_changed_;
 
   const LibvpxVp9EncoderInfoSettings encoder_info_override_;
-
-  const struct SvcFrameDropConfig {
-    bool enabled;
-    int layer_drop_mode;  // SVC_LAYER_DROP_MODE
-    int max_consec_drop;
-  } svc_frame_drop_config_;
-  static SvcFrameDropConfig ParseSvcFrameDropConfig(
-      const FieldTrialsView& trials);
 };
 
 }  // namespace webrtc
diff --git a/modules/video_coding/codecs/vp9/test/vp9_impl_unittest.cc b/modules/video_coding/codecs/vp9/test/vp9_impl_unittest.cc
index ae53001..2632610 100644
--- a/modules/video_coding/codecs/vp9/test/vp9_impl_unittest.cc
+++ b/modules/video_coding/codecs/vp9/test/vp9_impl_unittest.cc
@@ -2480,68 +2480,36 @@
     All,
     TestVp9ImplSvcFrameDropConfig,
     ::testing::Values(
-        // Flexible mode is disabled. Layer drop is not allowed. Ignore
-        // layer_drop_mode from field trial.
+        // Flexible mode is disabled, KSVC. Layer drop is not allowed.
         SvcFrameDropConfigTestParameters{
             .flexible_mode = false,
             .scalability_mode = ScalabilityMode::kL3T3_KEY,
-            .field_trial = "WebRTC-LibvpxVp9Encoder-SvcFrameDropConfig/"
-                           "Enabled,layer_drop_mode:1,max_consec_drop:7/",
             .expected_framedrop_mode = FULL_SUPERFRAME_DROP,
-            .expected_max_consec_drop = 7},
-        // Flexible mode is enabled but the field trial is not set. Use default
-        // settings.
+            .expected_max_consec_drop = 2},
+        // Flexible mode is enabled, KSVC. Layer drop is enabled.
         SvcFrameDropConfigTestParameters{
             .flexible_mode = true,
             .scalability_mode = ScalabilityMode::kL3T3_KEY,
-            .field_trial = "",
-            .expected_framedrop_mode = FULL_SUPERFRAME_DROP,
-            .expected_max_consec_drop = std::numeric_limits<int>::max()},
-        // Flexible mode is enabled but the field trial is disabled. Use default
-        // settings.
-        SvcFrameDropConfigTestParameters{
-            .flexible_mode = true,
-            .scalability_mode = ScalabilityMode::kL3T3_KEY,
-            .field_trial = "WebRTC-LibvpxVp9Encoder-SvcFrameDropConfig/"
-                           "Disabled,layer_drop_mode:1,max_consec_drop:7/",
-            .expected_framedrop_mode = FULL_SUPERFRAME_DROP,
-            .expected_max_consec_drop = std::numeric_limits<int>::max()},
-        // Flexible mode is enabled, layer drop is enabled, KSVC. Apply config
-        // from field trial.
-        SvcFrameDropConfigTestParameters{
-            .flexible_mode = true,
-            .scalability_mode = ScalabilityMode::kL3T3_KEY,
-            .field_trial = "WebRTC-LibvpxVp9Encoder-SvcFrameDropConfig/"
-                           "Enabled,layer_drop_mode:1,max_consec_drop:7/",
             .expected_framedrop_mode = LAYER_DROP,
-            .expected_max_consec_drop = 7},
-        // Flexible mode is enabled, layer drop is enabled, simulcast. Apply
-        // config from field trial.
+            .expected_max_consec_drop = 2},
+        // Flexible mode is enabled, simulcast. Layer drop is enabled.
         SvcFrameDropConfigTestParameters{
             .flexible_mode = true,
             .scalability_mode = ScalabilityMode::kS3T3,
-            .field_trial = "WebRTC-LibvpxVp9Encoder-SvcFrameDropConfig/"
-                           "Enabled,layer_drop_mode:1,max_consec_drop:7/",
             .expected_framedrop_mode = LAYER_DROP,
-            .expected_max_consec_drop = 7},
-        // Flexible mode is enabled, layer drop is enabled, full SVC. Apply
-        // config from field trial.
+            .expected_max_consec_drop = 2},
+        // Flexible mode is enabled, full SVC. Layer drop is not allowed.
         SvcFrameDropConfigTestParameters{
             .flexible_mode = false,
             .scalability_mode = ScalabilityMode::kL3T3,
-            .field_trial = "WebRTC-LibvpxVp9Encoder-SvcFrameDropConfig/"
-                           "Enabled,layer_drop_mode:1,max_consec_drop:7/",
             .expected_framedrop_mode = FULL_SUPERFRAME_DROP,
-            .expected_max_consec_drop = 7},
-        // Flexible mode is enabled, layer-drop is enabled, scalability mode is
-        // not set (i.e., SVC controller is not enabled). Ignore layer_drop_mode
-        // from field trial.
+            .expected_max_consec_drop = 2},
+        // Flexible mode is enabled, scalability mode is not set (i.e., SVC
+        // controller is not enabled). Layer drop is not allowed.
         SvcFrameDropConfigTestParameters{
             .flexible_mode = true,
             .scalability_mode = absl::nullopt,
-            .field_trial = "WebRTC-LibvpxVp9Encoder-SvcFrameDropConfig/"
-                           "Enabled,layer_drop_mode:1,max_consec_drop:7/",
             .expected_framedrop_mode = FULL_SUPERFRAME_DROP,
-            .expected_max_consec_drop = 7}));
+            .expected_max_consec_drop = 2}));
 
 }  // namespace webrtc