Hard-code WebRTC-ZeroHertzScreenshare default-on.

The field trial has been default on for ages. This CL removes it.

Bug: b/40200151
Change-Id: I171f663a3e725b856238b14b26d083f6684586e4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347621
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42080}
diff --git a/experiments/field_trials.py b/experiments/field_trials.py
index 450e424..43e2e73 100755
--- a/experiments/field_trials.py
+++ b/experiments/field_trials.py
@@ -901,9 +901,6 @@
     FieldTrial('WebRTC-Vp9IssueKeyFrameOnLayerDeactivation',
                'chromium:889017',
                date(2024, 4, 1)),
-    FieldTrial('WebRTC-ZeroHertzScreenshare',
-               'chromium:1255737',
-               date(2024, 4, 1)),
     FieldTrial('WebRTC-ZeroPlayoutDelay',
                'chromium:1335323',
                date(2024, 4, 1)),
@@ -911,7 +908,7 @@
 ])  # yapf: disable
 
 POLICY_EXEMPT_FIELD_TRIALS_DIGEST: str = \
-    '3026f839766eb90355893fa0f1af8e9bf0d0dca1'
+    '2387f9c58686fb4e4f9baa69b9323ef857255d6a'
 
 REGISTERED_FIELD_TRIALS: FrozenSet[FieldTrial] = ACTIVE_FIELD_TRIALS.union(
     POLICY_EXEMPT_FIELD_TRIALS)
diff --git a/video/frame_cadence_adapter.cc b/video/frame_cadence_adapter.cc
index 77f4ba9..0becc82 100644
--- a/video/frame_cadence_adapter.cc
+++ b/video/frame_cadence_adapter.cc
@@ -383,10 +383,6 @@
   Clock* const clock_;
   TaskQueueBase* const queue_;
 
-  // True if we support frame entry for screenshare with a minimum frequency of
-  // 0 Hz.
-  const bool zero_hertz_screenshare_enabled_;
-
   // Kill-switch for the queue overload mechanism in zero-hertz mode.
   const bool frame_cadence_adapter_zero_hertz_queue_overload_enabled_;
 
@@ -847,8 +843,6 @@
     const FieldTrialsView& field_trials)
     : clock_(clock),
       queue_(queue),
-      zero_hertz_screenshare_enabled_(
-          !field_trials.IsDisabled("WebRTC-ZeroHertzScreenshare")),
       frame_cadence_adapter_zero_hertz_queue_overload_enabled_(
           !field_trials.IsDisabled("WebRTC-ZeroHertzQueueOverload")),
       use_video_frame_timestamp_(field_trials.IsEnabled(
@@ -1016,7 +1010,7 @@
 
 bool FrameCadenceAdapterImpl::IsZeroHertzScreenshareEnabled() const {
   RTC_DCHECK_RUN_ON(queue_);
-  return zero_hertz_screenshare_enabled_ && source_constraints_.has_value() &&
+  return source_constraints_.has_value() &&
          source_constraints_->max_fps.value_or(-1) > 0 &&
          source_constraints_->min_fps.value_or(-1) == 0 &&
          zero_hertz_params_.has_value();
diff --git a/video/frame_cadence_adapter_unittest.cc b/video/frame_cadence_adapter_unittest.cc
index 94dfecc..d46434b 100644
--- a/video/frame_cadence_adapter_unittest.cc
+++ b/video/frame_cadence_adapter_unittest.cc
@@ -81,40 +81,6 @@
   MOCK_METHOD(void, RequestRefreshFrame, (), (override));
 };
 
-class ZeroHertzFieldTrialDisabler : public test::ScopedKeyValueConfig {
- public:
-  ZeroHertzFieldTrialDisabler()
-      : test::ScopedKeyValueConfig("WebRTC-ZeroHertzScreenshare/Disabled/") {}
-};
-
-class ZeroHertzFieldTrialEnabler : public test::ScopedKeyValueConfig {
- public:
-  ZeroHertzFieldTrialEnabler()
-      : test::ScopedKeyValueConfig("WebRTC-ZeroHertzScreenshare/Enabled/") {}
-};
-
-TEST(FrameCadenceAdapterTest,
-     ForwardsFramesOnConstructionAndUnderDisabledFieldTrial) {
-  GlobalSimulatedTimeController time_controller(Timestamp::Millis(1));
-  ZeroHertzFieldTrialDisabler disabled_field_trials;
-  test::ScopedKeyValueConfig no_field_trials;
-  for (int i = 0; i != 2; i++) {
-    MockCallback callback;
-    auto adapter =
-        CreateAdapter(i == 0 ? disabled_field_trials : no_field_trials,
-                      time_controller.GetClock());
-    adapter->Initialize(&callback);
-    VideoFrame frame = CreateFrame();
-    EXPECT_CALL(callback, OnFrame).Times(1);
-    adapter->OnFrame(frame);
-    time_controller.AdvanceTime(TimeDelta::Zero());
-    Mock::VerifyAndClearExpectations(&callback);
-    EXPECT_CALL(callback, OnDiscardedFrame).Times(1);
-    adapter->OnDiscardedFrame();
-    Mock::VerifyAndClearExpectations(&callback);
-  }
-}
-
 TEST(FrameCadenceAdapterTest, CountsOutstandingFramesToProcess) {
   test::ScopedKeyValueConfig no_field_trials;
   GlobalSimulatedTimeController time_controller(Timestamp::Millis(1));
@@ -157,37 +123,10 @@
   }
 }
 
-TEST(FrameCadenceAdapterTest,
-     FrameRateFollowsRateStatisticsWhenFeatureDisabled) {
-  ZeroHertzFieldTrialDisabler feature_disabler;
-  GlobalSimulatedTimeController time_controller(Timestamp::Zero());
-  auto adapter = CreateAdapter(feature_disabler, time_controller.GetClock());
-  MockCallback callback;
-  adapter->Initialize(&callback);
-
-  // Create an "oracle" rate statistics which should be followed on a sequence
-  // of frames.
-  RateStatistics rate(
-      FrameCadenceAdapterInterface::kFrameRateAveragingWindowSizeMs, 1000);
-
-  for (int frame = 0; frame != 10; ++frame) {
-    time_controller.AdvanceTime(TimeDelta::Millis(10));
-    absl::optional<int64_t> expected_fps =
-        rate.Rate(time_controller.GetClock()->TimeInMilliseconds());
-
-    rate.Update(1, time_controller.GetClock()->TimeInMilliseconds());
-    // FrameCadanceAdapter::OnFrame post the frame to another sequence.
-    adapter->OnFrame(CreateFrameWithTimestamps(&time_controller));
-    time_controller.AdvanceTime(TimeDelta::Millis(0));
-    EXPECT_EQ(adapter->GetInputFrameRateFps(), expected_fps)
-        << " failed for frame " << frame;
-  }
-}
-
 TEST(FrameCadenceAdapterTest, FrameRateFollowsMaxFpsWhenZeroHertzActivated) {
-  ZeroHertzFieldTrialEnabler enabler;
   GlobalSimulatedTimeController time_controller(Timestamp::Zero());
-  auto adapter = CreateAdapter(enabler, time_controller.GetClock());
+  test::ScopedKeyValueConfig no_field_trials;
+  auto adapter = CreateAdapter(no_field_trials, time_controller.GetClock());
   MockCallback callback;
   adapter->Initialize(&callback);
   adapter->SetZeroHertzModeEnabled(
@@ -203,9 +142,9 @@
 }
 
 TEST(FrameCadenceAdapterTest, ZeroHertzAdapterSupportsMaxFpsChange) {
-  ZeroHertzFieldTrialEnabler enabler;
   GlobalSimulatedTimeController time_controller(Timestamp::Zero());
-  auto adapter = CreateAdapter(enabler, time_controller.GetClock());
+  test::ScopedKeyValueConfig no_field_trials;
+  auto adapter = CreateAdapter(no_field_trials, time_controller.GetClock());
   MockCallback callback;
   adapter->Initialize(&callback);
   adapter->SetZeroHertzModeEnabled(
@@ -227,9 +166,9 @@
 
 TEST(FrameCadenceAdapterTest,
      FrameRateFollowsRateStatisticsAfterZeroHertzDeactivated) {
-  ZeroHertzFieldTrialEnabler enabler;
   GlobalSimulatedTimeController time_controller(Timestamp::Zero());
-  auto adapter = CreateAdapter(enabler, time_controller.GetClock());
+  test::ScopedKeyValueConfig no_field_trials;
+  auto adapter = CreateAdapter(no_field_trials, time_controller.GetClock());
   MockCallback callback;
   adapter->Initialize(&callback);
   adapter->SetZeroHertzModeEnabled(
@@ -257,10 +196,10 @@
 }
 
 TEST(FrameCadenceAdapterTest, ForwardsFramesDelayed) {
-  ZeroHertzFieldTrialEnabler enabler;
   MockCallback callback;
   GlobalSimulatedTimeController time_controller(Timestamp::Zero());
-  auto adapter = CreateAdapter(enabler, time_controller.GetClock());
+  test::ScopedKeyValueConfig no_field_trials;
+  auto adapter = CreateAdapter(no_field_trials, time_controller.GetClock());
   adapter->Initialize(&callback);
   adapter->SetZeroHertzModeEnabled(
       FrameCadenceAdapterInterface::ZeroHertzModeParams{});
@@ -287,9 +226,9 @@
 }
 
 TEST(FrameCadenceAdapterTest, DelayedProcessingUnderSlightContention) {
-  ZeroHertzFieldTrialEnabler enabler;
   GlobalSimulatedTimeController time_controller(Timestamp::Zero());
-  auto adapter = CreateAdapter(enabler, time_controller.GetClock());
+  test::ScopedKeyValueConfig no_field_trials;
+  auto adapter = CreateAdapter(no_field_trials, time_controller.GetClock());
   MockCallback callback;
   adapter->Initialize(&callback);
   adapter->SetZeroHertzModeEnabled(
@@ -309,9 +248,9 @@
 }
 
 TEST(FrameCadenceAdapterTest, DelayedProcessingUnderHeavyContention) {
-  ZeroHertzFieldTrialEnabler enabler;
   GlobalSimulatedTimeController time_controller(Timestamp::Zero());
-  auto adapter = CreateAdapter(enabler, time_controller.GetClock());
+  test::ScopedKeyValueConfig no_field_trials;
+  auto adapter = CreateAdapter(no_field_trials, time_controller.GetClock());
   MockCallback callback;
   adapter->Initialize(&callback);
   adapter->SetZeroHertzModeEnabled(
@@ -337,10 +276,10 @@
   // clock is initialized running from 0. For this reason we choose the
   // `time_controller` initialization constant to something arbitrary which is
   // not 0.
-  ZeroHertzFieldTrialEnabler enabler;
   MockCallback callback;
   GlobalSimulatedTimeController time_controller(Timestamp::Millis(47892223));
-  auto adapter = CreateAdapter(enabler, time_controller.GetClock());
+  test::ScopedKeyValueConfig no_field_trials;
+  auto adapter = CreateAdapter(no_field_trials, time_controller.GetClock());
   adapter->Initialize(&callback);
   adapter->SetZeroHertzModeEnabled(
       FrameCadenceAdapterInterface::ZeroHertzModeParams{});
@@ -391,10 +330,10 @@
   // it to zero, but select unset timestamps in the frames (via CreateFrame())
   // and verify that the timestamp modifying logic doesn't depend on the current
   // time.
-  ZeroHertzFieldTrialEnabler enabler;
   MockCallback callback;
   GlobalSimulatedTimeController time_controller(Timestamp::Millis(4711));
-  auto adapter = CreateAdapter(enabler, time_controller.GetClock());
+  test::ScopedKeyValueConfig no_field_trials;
+  auto adapter = CreateAdapter(no_field_trials, time_controller.GetClock());
   adapter->Initialize(&callback);
   adapter->SetZeroHertzModeEnabled(
       FrameCadenceAdapterInterface::ZeroHertzModeParams{});
@@ -424,10 +363,10 @@
   // At 2s, the repeated initial frame appears.
   // At 2.5s, we schedule another new frame.
   // At 3.5s, we receive this frame.
-  ZeroHertzFieldTrialEnabler enabler;
   MockCallback callback;
   GlobalSimulatedTimeController time_controller(Timestamp::Zero());
-  auto adapter = CreateAdapter(enabler, time_controller.GetClock());
+  test::ScopedKeyValueConfig no_field_trials;
+  auto adapter = CreateAdapter(no_field_trials, time_controller.GetClock());
   adapter->Initialize(&callback);
   adapter->SetZeroHertzModeEnabled(
       FrameCadenceAdapterInterface::ZeroHertzModeParams{});
@@ -452,10 +391,10 @@
 }
 
 TEST(FrameCadenceAdapterTest, RequestsRefreshFrameOnKeyFrameRequestWhenNew) {
-  ZeroHertzFieldTrialEnabler enabler;
   MockCallback callback;
   GlobalSimulatedTimeController time_controller(Timestamp::Zero());
-  auto adapter = CreateAdapter(enabler, time_controller.GetClock());
+  test::ScopedKeyValueConfig no_field_trials;
+  auto adapter = CreateAdapter(no_field_trials, time_controller.GetClock());
   adapter->Initialize(&callback);
   adapter->SetZeroHertzModeEnabled(
       FrameCadenceAdapterInterface::ZeroHertzModeParams{});
@@ -470,10 +409,10 @@
 }
 
 TEST(FrameCadenceAdapterTest, IgnoresKeyFrameRequestShortlyAfterFrame) {
-  ZeroHertzFieldTrialEnabler enabler;
   MockCallback callback;
   GlobalSimulatedTimeController time_controller(Timestamp::Zero());
-  auto adapter = CreateAdapter(enabler, time_controller.GetClock());
+  test::ScopedKeyValueConfig no_field_trials;
+  auto adapter = CreateAdapter(no_field_trials, time_controller.GetClock());
   adapter->Initialize(&callback);
   adapter->SetZeroHertzModeEnabled(
       FrameCadenceAdapterInterface::ZeroHertzModeParams{});
@@ -485,10 +424,10 @@
 }
 
 TEST(FrameCadenceAdapterTest, RequestsRefreshFramesUntilArrival) {
-  ZeroHertzFieldTrialEnabler enabler;
   MockCallback callback;
   GlobalSimulatedTimeController time_controller(Timestamp::Zero());
-  auto adapter = CreateAdapter(enabler, time_controller.GetClock());
+  test::ScopedKeyValueConfig no_field_trials;
+  auto adapter = CreateAdapter(no_field_trials, time_controller.GetClock());
   adapter->Initialize(&callback);
   adapter->SetZeroHertzModeEnabled(
       FrameCadenceAdapterInterface::ZeroHertzModeParams{});
@@ -511,10 +450,10 @@
 }
 
 TEST(FrameCadenceAdapterTest, RequestsRefreshAfterFrameDrop) {
-  ZeroHertzFieldTrialEnabler enabler;
   MockCallback callback;
   GlobalSimulatedTimeController time_controller(Timestamp::Zero());
-  auto adapter = CreateAdapter(enabler, time_controller.GetClock());
+  test::ScopedKeyValueConfig no_field_trials;
+  auto adapter = CreateAdapter(no_field_trials, time_controller.GetClock());
   adapter->Initialize(&callback);
   adapter->SetZeroHertzModeEnabled(
       FrameCadenceAdapterInterface::ZeroHertzModeParams{});
@@ -552,10 +491,10 @@
 }
 
 TEST(FrameCadenceAdapterTest, OmitsRefreshAfterFrameDropWithTimelyFrameEntry) {
-  ZeroHertzFieldTrialEnabler enabler;
   MockCallback callback;
   GlobalSimulatedTimeController time_controller(Timestamp::Zero());
-  auto adapter = CreateAdapter(enabler, time_controller.GetClock());
+  test::ScopedKeyValueConfig no_field_trials;
+  auto adapter = CreateAdapter(no_field_trials, time_controller.GetClock());
   adapter->Initialize(&callback);
   adapter->SetZeroHertzModeEnabled(
       FrameCadenceAdapterInterface::ZeroHertzModeParams{});
@@ -591,10 +530,10 @@
 
 TEST(FrameCadenceAdapterTest, AcceptsUnconfiguredLayerFeedback) {
   // This is a regression test for bugs.webrtc.org/14417.
-  ZeroHertzFieldTrialEnabler enabler;
   MockCallback callback;
   GlobalSimulatedTimeController time_controller(Timestamp::Zero());
-  auto adapter = CreateAdapter(enabler, time_controller.GetClock());
+  test::ScopedKeyValueConfig no_field_trials;
+  auto adapter = CreateAdapter(no_field_trials, time_controller.GetClock());
   adapter->Initialize(&callback);
   adapter->SetZeroHertzModeEnabled(
       FrameCadenceAdapterInterface::ZeroHertzModeParams{.num_simulcast_layers =
@@ -608,14 +547,14 @@
 }
 
 TEST(FrameCadenceAdapterTest, IgnoresDropInducedCallbacksPostDestruction) {
-  ZeroHertzFieldTrialEnabler enabler;
   auto callback = std::make_unique<MockCallback>();
   GlobalSimulatedTimeController time_controller(Timestamp::Zero());
   auto queue = time_controller.GetTaskQueueFactory()->CreateTaskQueue(
       "queue", TaskQueueFactory::Priority::NORMAL);
+  test::ScopedKeyValueConfig no_field_trials;
   auto adapter = FrameCadenceAdapterInterface::Create(
       time_controller.GetClock(), queue.get(), /*metronome=*/nullptr,
-      /*worker_queue=*/nullptr, enabler);
+      /*worker_queue=*/nullptr, no_field_trials);
   queue->PostTask([&adapter, &callback] {
     adapter->Initialize(callback.get());
     adapter->SetZeroHertzModeEnabled(
@@ -632,7 +571,6 @@
 }
 
 TEST(FrameCadenceAdapterTest, EncodeFramesAreAlignedWithMetronomeTick) {
-  ZeroHertzFieldTrialEnabler enabler;
   GlobalSimulatedTimeController time_controller(Timestamp::Zero());
   // Here the metronome interval is 33ms, because the metronome is not
   // infrequent then the encode tasks are aligned with the tick period.
@@ -642,9 +580,10 @@
   auto worker_queue = time_controller.GetTaskQueueFactory()->CreateTaskQueue(
       "work_queue", TaskQueueFactory::Priority::NORMAL);
   static test::FakeMetronome metronome(kTickPeriod);
+  test::ScopedKeyValueConfig no_field_trials;
   auto adapter = FrameCadenceAdapterInterface::Create(
       time_controller.GetClock(), queue.get(), &metronome, worker_queue.get(),
-      enabler);
+      no_field_trials);
   MockCallback callback;
   adapter->Initialize(&callback);
   auto frame = CreateFrame();
@@ -730,11 +669,11 @@
   int NumSpatialLayers() const { return GetParam(); }
 
  protected:
-  ZeroHertzFieldTrialEnabler enabler_;
+  test::ScopedKeyValueConfig no_field_trials_;
   MockCallback callback_;
   GlobalSimulatedTimeController time_controller_{Timestamp::Zero()};
   const std::unique_ptr<FrameCadenceAdapterInterface> adapter_{
-      CreateAdapter(enabler_, time_controller_.GetClock())};
+      CreateAdapter(no_field_trials_, time_controller_.GetClock())};
 };
 
 TEST_P(FrameCadenceAdapterSimulcastLayersParamTest,
@@ -859,11 +798,11 @@
   }
 
  protected:
-  ZeroHertzFieldTrialEnabler field_trial_enabler_;
+  test::ScopedKeyValueConfig no_field_trials_;
   MockCallback callback_;
   GlobalSimulatedTimeController time_controller_{Timestamp::Zero()};
   std::unique_ptr<FrameCadenceAdapterInterface> adapter_{
-      CreateAdapter(field_trial_enabler_, time_controller_.GetClock())};
+      CreateAdapter(no_field_trials_, time_controller_.GetClock())};
 };
 
 TEST_F(ZeroHertzLayerQualityConvergenceTest, InitialStateUnconverged) {
@@ -1082,7 +1021,6 @@
   auto factory = CreateDefaultTaskQueueFactory();
   auto queue =
       factory->CreateTaskQueue("test", TaskQueueFactory::Priority::NORMAL);
-  ZeroHertzFieldTrialEnabler enabler;
   MockCallback callback;
   Clock* clock = Clock::GetRealTimeClock();
   std::unique_ptr<FrameCadenceAdapterInterface> adapter;
@@ -1090,8 +1028,9 @@
   int64_t original_ntp_time_ms;
   int64_t original_timestamp_us;
   rtc::Event event;
+  test::ScopedKeyValueConfig no_field_trials;
   queue->PostTask([&] {
-    adapter = CreateAdapter(enabler, clock);
+    adapter = CreateAdapter(no_field_trials, clock);
     adapter->Initialize(&callback);
     adapter->SetZeroHertzModeEnabled(
         FrameCadenceAdapterInterface::ZeroHertzModeParams{});
@@ -1149,15 +1088,15 @@
   auto factory = CreateDefaultTaskQueueFactory();
   auto queue =
       factory->CreateTaskQueue("test", TaskQueueFactory::Priority::NORMAL);
-  ZeroHertzFieldTrialEnabler enabler;
   MockCallback callback;
   Clock* clock = Clock::GetRealTimeClock();
   std::unique_ptr<FrameCadenceAdapterInterface> adapter;
   int frame_counter = 0;
   rtc::Event event;
   absl::optional<Timestamp> start_time;
+  test::ScopedKeyValueConfig no_field_trials;
   queue->PostTask([&] {
-    adapter = CreateAdapter(enabler, clock);
+    adapter = CreateAdapter(no_field_trials, clock);
     adapter->Initialize(&callback);
     adapter->SetZeroHertzModeEnabled(
         FrameCadenceAdapterInterface::ZeroHertzModeParams{});
diff --git a/video/video_stream_encoder_unittest.cc b/video/video_stream_encoder_unittest.cc
index dda377e..d598907 100644
--- a/video/video_stream_encoder_unittest.cc
+++ b/video/video_stream_encoder_unittest.cc
@@ -9701,9 +9701,7 @@
       factory.GetTimeController()->GetTaskQueueFactory()->CreateTaskQueue(
           "EncoderQueue", TaskQueueFactory::Priority::NORMAL);
 
-  // Enables zero-hertz mode.
-  test::ScopedKeyValueConfig field_trials(
-      "WebRTC-ZeroHertzScreenshare/Enabled/");
+  test::ScopedKeyValueConfig field_trials;
   auto adapter = FrameCadenceAdapterInterface::Create(
       factory.GetTimeController()->GetClock(), encoder_queue.get(),
       /*metronome=*/nullptr, /*worker_queue=*/nullptr, field_trials);