26 lines
1016 B
Diff
26 lines
1016 B
Diff
MPRIS: skip the seek signal for infinite-duration position states
|
|
|
|
YouTube calls setPositionState({duration: Infinity}) every ~15 s. Each one
|
|
resets the MPRIS position and emits a seek signal, which makes gnome-shell run a
|
|
full JS GC that stalls mutter for ~37 ms and drops video frames.
|
|
|
|
--- a/components/system_media_controls/linux/system_media_controls_linux.cc
|
|
+++ b/components/system_media_controls/linux/system_media_controls_linux.cc
|
|
@@ -548,10 +548,16 @@
|
|
|
|
if (!service_ready_ || !emit_signal || !position_.has_value()) {
|
|
return;
|
|
}
|
|
|
|
+ // An infinite duration has no seekable position. YouTube resets such a state
|
|
+ // every ~15 s, and each seek signal triggers a full JS GC in gnome-shell.
|
|
+ if (position_->duration().is_inf()) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
dbus::Signal seeked_signal(kMprisAPIPlayerInterfaceName,
|
|
kMprisAPISignalSeeked);
|
|
dbus::MessageWriter writer(&seeked_signal);
|
|
writer.AppendInt64(position);
|
|
exported_object_->SendSignal(&seeked_signal);
|