Open Bug 1305288 Opened 8 years ago Updated 10 months ago

Incomplete video playback power management / screensaver inhibition on Linux

Categories

(Core :: Widget: Gtk, enhancement, P5)

All
Linux
enhancement

Tracking

()

People

(Reporter: me, Unassigned)

References

Details

(Whiteboard: tpi:+)

This is a follow up from bug 811261 for a corner case of automatic playlist / suggested videos playback as in YouTube autoplay.

The screensaver inhibition as implemented now works well for a single long video, but it fails for a video playlist (or suggested videos) with automatic page reload for continuous video reproduction.

The power management / screensaver inhibition stops right after reproduction of a video stops if the time for a screen lock has come (e.g. the idle timeout lock is 5 mins and a video was played for 6 min). In this case, if the page is not reloaded almost instantly (as is the case for suggested videos in YT where it waits for 10 seconds before playing next video or on slow connection with a playlist), the screen locks BEFORE the page reloads and a new video starts playing (the inhibition for the new video comes too late, on already locked screen).

The low-level screensaver inhibition implementation is in WakeLockListener.cpp (WakeLockTopic::SendInhibit() and WakeLockTopic::SendUninhibit() functions).

The proposed change is to simulate user activity before canceling the inhibition (i.e. sending "UnInhibit" message to dbus inside SendUninhibit function). In this case there will be a delay equal to the screen lock idle timeout and it'll be enough for the page to go to the next video under all normal circumstances and start its playback, inhibiting again the screen lock. And if there is no next video, the screen will lock after the idle timeout expires as usual.

Both Freedesktop and GNOME (https://people.gnome.org/~mccann/gnome-screensaver/docs/gnome-screensaver.html#gs-method-SimulateUserActivity) Screensaver APIs provide a method SimulateUserActivity that could be called inside WakeLockTopic::SendUninhibit() function before sending "UnInhibit" message to dbus (i.e. code to be inserted at lines 179 and 185 in https://dxr.mozilla.org/mozilla-central/source/widget/gtk/WakeLockListener.cpp).

This will reset system idle counters before releasing the inhibit lock and prevent screen lock for <system_idle_timeout> period after the release.

The new behavior could be controlled by an option accessible via about:config if some find it undesirable.
Severity: normal → enhancement
Component: Shell Integration → Widget: Gtk
Product: Firefox → Core
Priority: -- → P5
Whiteboard: tpi:+
Status: UNCONFIRMED → NEW
Depends on: 811261
Ever confirmed: true
FYI: I posted a comment here ==> (https://bugzilla.mozilla.org/show_bug.cgi?id=1168090#c19)
which may be relevant to this issue, too.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.