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}
This commit is contained in:
Markus Handell 2024-04-16 10:40:45 +02:00 committed by WebRTC LUCI CQ
parent 9c95a4f704
commit a57229bf36
4 changed files with 45 additions and 117 deletions

View file

@ -901,9 +901,6 @@ POLICY_EXEMPT_FIELD_TRIALS: FrozenSet[FieldTrial] = frozenset([
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 @@ POLICY_EXEMPT_FIELD_TRIALS: FrozenSet[FieldTrial] = frozenset([
]) # yapf: disable
POLICY_EXEMPT_FIELD_TRIALS_DIGEST: str = \
'3026f839766eb90355893fa0f1af8e9bf0d0dca1'
'2387f9c58686fb4e4f9baa69b9323ef857255d6a'
REGISTERED_FIELD_TRIALS: FrozenSet[FieldTrial] = ACTIVE_FIELD_TRIALS.union(
POLICY_EXEMPT_FIELD_TRIALS)

View file

@ -383,10 +383,6 @@ class FrameCadenceAdapterImpl : public FrameCadenceAdapterInterface {
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 @@ FrameCadenceAdapterImpl::FrameCadenceAdapterImpl(
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 @@ void FrameCadenceAdapterImpl::OnFrameOnMainQueue(Timestamp post_time,
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();

View file

@ -81,40 +81,6 @@ class MockCallback : public FrameCadenceAdapterInterface::Callback {
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, FrameRateFollowsRateStatisticsByDefault) {
}
}
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, FrameRateFollowsMaxFpsWhenZeroHertzActivated) {
}
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, ZeroHertzAdapterSupportsMaxFpsChange) {
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,
}
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, ForwardsFramesDelayed) {
}
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, DelayedProcessingUnderSlightContention) {
}
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 @@ TEST(FrameCadenceAdapterTest, RepeatsFramesDelayed) {
// 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 @@ TEST(FrameCadenceAdapterTest,
// 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 @@ TEST(FrameCadenceAdapterTest, StopsRepeatingFramesDelayed) {
// 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, StopsRepeatingFramesDelayed) {
}
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, RequestsRefreshFrameOnKeyFrameRequestWhenNew) {
}
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, IgnoresKeyFrameRequestShortlyAfterFrame) {
}
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, RequestsRefreshFramesUntilArrival) {
}
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, RequestsRefreshAfterFrameDrop) {
}
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, OmitsRefreshAfterFrameDropWithTimelyFrameEntry) {
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, AcceptsUnconfiguredLayerFeedback) {
}
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, IgnoresDropInducedCallbacksPostDestruction) {
}
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 @@ TEST(FrameCadenceAdapterTest, EncodeFramesAreAlignedWithMetronomeTick) {
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 @@ class FrameCadenceAdapterSimulcastLayersParamTest
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 @@ class ZeroHertzLayerQualityConvergenceTest : public ::testing::Test {
}
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 @@ TEST(FrameCadenceAdapterRealTimeTest, TimestampsDoNotDrift) {
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 @@ TEST(FrameCadenceAdapterRealTimeTest, TimestampsDoNotDrift) {
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 @@ TEST(FrameCadenceAdapterRealTimeTest,
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{});

View file

@ -9701,9 +9701,7 @@ TEST(VideoStreamEncoderFrameCadenceTest,
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);