Closing Picture-in-Picture (PiP) window doesn't set tab's priority to background tab
Categories
(Toolkit :: Picture-in-Picture, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox107 | --- | verified |
People
(Reporter: whimboo, Assigned: florian)
References
(Blocks 1 open bug)
Details
(Keywords: perf:resource-use, power)
Attachments
(1 file)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Firefox/102.0 ID:20220515214519
When I'm watching some videos on AirMozilla and using the PiP (picture in picture) mode, I can see a huge CPU load (50% main process) for the Panopto tab. As given by Smaug and Florian this happens because we treat the tab as forground tab.
But when I close the PiP player window the CPU load stays high for some minutes before dropping to normal values again.
Here a recorded profile when I closed the PiP window and left the profiler running some more seconds: https://share.firefox.dev/39QRa59
As told by Florian the priority of the tab is actually set to background so it's not clear why we are rendering still with 120Hz.
Comment 1•3 years ago
|
||
Henrik, fwiw, can you please attach your about:support to this so Glenn has more information?
| Reporter | ||
Comment 2•3 years ago
|
||
This is actually a Picture-in-Picture bug. So with the PiP window open we keep the tab's priority (even when in background) as foreground. But when closing the window (with the tab still in background) doesn't adjust the priority to background and keeps it running with foreground priority instead. Only when you select the tab, and deselect the background priority is correctly set.
Here the steps:
- Open a tab with AirMozilla and select a video
- Start video and move it to a PiP window
- Open another tab in the foreground
- Inspect the CPU load of Firefox which is high for the main process (~50%) due to some CSS animation on the page
- Close the PiP window
- Inspect the CPU load again and notice that there is no change
- Select the AirMozilla tab
- Select the other tab
- Inspect the CPU load once again and notice that the load has been dropped (~5%)
A profile with these steps you can find here: https://share.firefox.dev/3LFDZBj
| Reporter | ||
Comment 3•3 years ago
|
||
The CSS animation related power issue I filed as bug 1771078.
Updated•3 years ago
|
| Assignee | ||
Comment 4•3 years ago
|
||
This is indeed easy to reproduce. I captured a profile following the steps in comment 2: https://share.firefox.dev/3RBNdSi
The profiles (both mine and the one from comment 2) confirm that the tab priority is correctly set to background (see https://share.firefox.dev/3SBGGZ4) when the PiP window is closed. On the compositor track however, we only clear the animations at step #8 (of the steps in comment 2), https://share.firefox.dev/3ybGuHK
| Assignee | ||
Comment 5•3 years ago
|
||
Updated•3 years ago
|
| Assignee | ||
Comment 6•3 years ago
|
||
So it turns out the priority of the content process was correctly set to "background", but that was a side effect of stopping the media playback; the browser's docshell was not set to inactive. Here is a profile with the patch included: https://share.firefox.dev/3e8U3RF
Comment 8•3 years ago
|
||
| bugherder | ||
Updated•3 years ago
|
Comment 9•2 years ago
|
||
Verified as fixed in our latest 107 build.
I was able to reproduce this issue using the steps from Comment 2, This issue is verified as fixed.
Description
•