Set the screen frame rate to 60 Hz: fix video playback extremely choppy (#2877)

Fixes a destructive conflict between the 60Hz anti-fingerprinting
snapping logic (kThrottleMainFrameTo60Hz) and the native
kOnBeginFrameThrottleVideo feature when hardware VSync is disabled.

The artificial timestamp snapping introduced by the anti-fingerprinting
patch tricks the viz video throttling heuristics into thinking the
playback is unstable, forcing the compositor to drop BeginFrame
intervals to 30Hz (33.3ms). This leads to false lost frames and severe
stuttering in the media pipeline. Disabling kOnBeginFrameThrottleVideo
restores the continuous 60Hz rhythm.
This commit is contained in:
Carmelo Messina
2026-07-10 13:30:20 +02:00
parent 010ed3a42e
commit 36e44acc71
@@ -15,6 +15,7 @@ License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
chrome/browser/about_flags.cc | 6 +++---
.../browser/chrome_content_browser_client.cc | 11 +++++++++++
.../Set-the-screen-frame-rate-to-60-Hz.grdp | 9 +++++++++
components/viz/common/features.cc | 3 +++
.../common/frame_sinks/begin_frame_source.cc | 14 +++++++++++++-
.../common/frame_sinks/begin_frame_source.h | 1 +
.../frame_sinks/delay_based_time_source.cc | 2 +-
@@ -25,7 +26,7 @@ License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
.../Set-the-screen-frame-rate-to-60-Hz.inc | 7 +++++++
.../core/animation/animation_clock.cc | 11 ++++++++---
.../core/view_transition/view_transition.cc | 2 ++
16 files changed, 120 insertions(+), 20 deletions(-)
17 files changed, 123 insertions(+), 20 deletions(-)
create mode 100644 chrome/browser/ui/android/strings/cromite_android_chrome_strings_grd/Set-the-screen-frame-rate-to-60-Hz.grdp
create mode 100644 cromite_flags/chrome/browser/about_flags_cc/Set-the-screen-frame-rate-to-60-Hz.inc
@@ -179,6 +180,26 @@ new file mode 100644
+ Throttle compositor frame rate to 60fps, even when VSync rate is higher.
+ </message>
+</grit-part>
diff --git a/components/viz/common/features.cc b/components/viz/common/features.cc
--- a/components/viz/common/features.cc
+++ b/components/viz/common/features.cc
@@ -22,6 +22,7 @@
#include "gpu/config/gpu_switches.h"
#include "media/media_buildflags.h"
#include "ui/gl/gl_switches.h"
+#include "cc/base/features.h"
#if BUILDFLAG(IS_ANDROID)
#include "base/android/device_info.h"
@@ -468,6 +469,8 @@ int MaxOverlaysConsidered() {
}
bool ShouldOnBeginFrameThrottleVideo() {
+ if (base::FeatureList::IsEnabled(features::kThrottleMainFrameTo60Hz))
+ return false;
return base::FeatureList::IsEnabled(features::kOnBeginFrameThrottleVideo);
}
diff --git a/components/viz/common/frame_sinks/begin_frame_source.cc b/components/viz/common/frame_sinks/begin_frame_source.cc
--- a/components/viz/common/frame_sinks/begin_frame_source.cc
+++ b/components/viz/common/frame_sinks/begin_frame_source.cc