Open Bug 1854920 Opened 2 years ago Updated 2 years ago

[Wayland] PiP subtitles stop updating for Youtube videos when browser window minimized unless widget.wayland.vsync.keep-firing-at-idle = true

Categories

(Core :: Widget: Gtk, defect, P3)

Firefox 120
defect

Tracking

()

Tracking Status
firefox-esr115 --- wontfix
firefox118 --- wontfix
firefox119 --- affected
firefox120 --- affected

People

(Reporter: ke5trel, Unassigned)

References

(Blocks 2 open bugs, )

Details

STR:

  1. Start with MOZ_ENABLE_WAYLAND=1 on Ubuntu 23.04.
  2. Open a Youtube video in Picture-in-Picture.
  3. Enable subtitles.
  4. Minimize the browser window.

Subtitles in the PiP window stop reliably updating when the browser window is minimized and not visible. They update when the window is exposed in the interface or sometimes randomly.

Does not happen with MOZ_ENABLE_WAYLAND=0 or widget.wayland.vsync.keep-firing-at-idle = true. Other video sites like BBC, Air Mozilla and DailyMotion are unaffected.

Not a regression, reproducible back to 2022-03-01 around when subtitles were introduced. The lack of prior reports suggests a Youtube change, recently the video player was changed to allow for rounded corners (Bug 1849680).

I noticed the same issue on YouTube when Firefox main window was not shown because it was on another workspace. I didn't report since I was using a less popular Wayland compositor (wayfire) and it hadn't been a bug issue for me as I didn't use PiP a lot. It had been happening for me since subtitles were added to the PiP window.

Looks like PIP subtitles are driven by parent window refresh driver instead of the PIP one. I wonder if PIP window even have its own refresh driver.
Mike, any idea here?
Thanks.

Flags: needinfo?(mconley)

I believe what we do here is that the AsyncTabSwitcher detects when the window becomes either occluded or minimized: https://searchfox.org/mozilla-central/rev/5ad226c7379b0564c76dc3b54b44985356f94c5a/browser/modules/AsyncTabSwitcher.sys.mjs#848-857

and then we make a decision as to whether we "deactivate the DocShell" (it also will throw away the display list for tabs in the window): https://searchfox.org/mozilla-central/rev/5ad226c7379b0564c76dc3b54b44985356f94c5a/browser/modules/AsyncTabSwitcher.sys.mjs#855

However, we exempt any tabs associated with a source browser for a Picture-in-Picture player window. So, at least from Gecko's reckoning, I believe the minimized <browser> should still be considered "active", and still be ticking at the normal refresh rate. Does Wayland somehow override Gecko's ability to keep refreshing despite being minimized?

Flags: needinfo?(mconley)

(In reply to Mike Conley (:mconley) (:⚙️) from comment #3)

However, we exempt any tabs associated with a source browser for a Picture-in-Picture player window. So, at least from Gecko's reckoning, I believe the minimized <browser> should still be considered "active", and still be ticking at the normal refresh rate. Does Wayland somehow override Gecko's ability to keep refreshing despite being minimized?

Yes. Wayland use OS driven refresh events. If a window is hidden we don't get any OS level events and we switch to 'idle' timer and throw occlusion event:

https://searchfox.org/mozilla-central/rev/e9b338c2d597067f99e96d5f20769f41f312fa8f/widget/gtk/WaylandVsyncSource.cpp#286
https://searchfox.org/mozilla-central/rev/e9b338c2d597067f99e96d5f20769f41f312fa8f/widget/gtk/WaylandVsyncSource.cpp#305

I mean window state events (minimized and so) is not reliable on Linux/Gtk and we don't use it. See Bug 1826291.

Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.