NEW 164529
Pages running in non-visible tabs use large amounts of CPU decoding video
https://bugs.webkit.org/show_bug.cgi?id=164529
Summary Pages running in non-visible tabs use large amounts of CPU decoding video
Jer Noble
Reported 2016-11-08 15:33:42 PST
Pages running in non-visible tabs use large amounts of CPU decoding video
Attachments
Patch (33.63 KB, patch)
2016-11-08 22:55 PST, Jer Noble
no flags
Archive of layout-test-results from ews103 for mac-yosemite (998.65 KB, application/zip)
2016-11-08 23:58 PST, Build Bot
no flags
Archive of layout-test-results from ews105 for mac-yosemite-wk2 (1.18 MB, application/zip)
2016-11-08 23:58 PST, Build Bot
no flags
Archive of layout-test-results from ews123 for ios-simulator-wk2 (17.95 MB, application/zip)
2016-11-09 00:13 PST, Build Bot
no flags
Patch (33.63 KB, patch)
2016-11-09 09:55 PST, Jer Noble
no flags
Archive of layout-test-results from ews103 for mac-yosemite (932.13 KB, application/zip)
2016-11-09 10:56 PST, Build Bot
no flags
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (1.05 MB, application/zip)
2016-11-09 10:58 PST, Build Bot
no flags
Patch (41.00 KB, patch)
2016-11-09 11:11 PST, Jer Noble
no flags
Archive of layout-test-results from ews126 for ios-simulator-wk2 (deleted)
2016-11-09 12:11 PST, Build Bot
no flags
Archive of layout-test-results from ews100 for mac-yosemite (1.12 MB, application/zip)
2016-11-09 12:29 PST, Build Bot
no flags
Archive of layout-test-results from ews113 for mac-yosemite (1.81 MB, application/zip)
2016-11-09 14:33 PST, Build Bot
no flags
Patch (51.84 KB, patch)
2016-11-14 09:39 PST, Jer Noble
no flags
Archive of layout-test-results from ews101 for mac-yosemite (932.62 KB, application/zip)
2016-11-14 10:49 PST, Build Bot
no flags
Archive of layout-test-results from ews116 for mac-yosemite (1.63 MB, application/zip)
2016-11-14 10:49 PST, Build Bot
no flags
Archive of layout-test-results from ews123 for ios-simulator-wk2 (deleted)
2016-11-14 10:56 PST, Build Bot
no flags
Patch (51.82 KB, patch)
2016-11-14 13:21 PST, Jer Noble
no flags
Archive of layout-test-results from ews103 for mac-yosemite (943.39 KB, application/zip)
2016-11-14 14:21 PST, Build Bot
no flags
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (1.16 MB, application/zip)
2016-11-14 14:30 PST, Build Bot
no flags
Archive of layout-test-results from ews113 for mac-yosemite (1.73 MB, application/zip)
2016-11-14 14:31 PST, Build Bot
no flags
Archive of layout-test-results from ews123 for ios-simulator-wk2 (deleted)
2016-11-14 14:44 PST, Build Bot
no flags
Patch (51.78 KB, patch)
2016-11-15 15:55 PST, Jer Noble
beidson: review-
buildbot: commit-queue-
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (1.32 MB, application/zip)
2016-11-15 17:02 PST, Build Bot
no flags
Archive of layout-test-results from ews102 for mac-yosemite (1.26 MB, application/zip)
2016-11-15 17:31 PST, Build Bot
no flags
Archive of layout-test-results from ews115 for mac-yosemite (2.19 MB, application/zip)
2016-11-15 17:36 PST, Build Bot
no flags
Archive of layout-test-results from ews124 for ios-simulator-wk2 (deleted)
2016-11-15 18:05 PST, Build Bot
no flags
Jer Noble
Comment 1 2016-11-08 21:30:58 PST
After discussing this with rniwa, I have decided not to add a PerformanceTest test for this change. Ryosuke explained that performance tests should not be used as regression tests. It would also be difficult to write a LayoutTest for this change to verify that decoders are not active during the running of such a test, as other video-decoder-using tests may be active concurrently with this hypothetical test. The only remaining test to write would be one that returned the number of "active" tracks (rather than just enabled tracks) when the page is not visible. The only thing this test would verify is that we actually disable the tracks when pages are backgrounded, but not that decoders stop or that CPU resources are returned.
Jer Noble
Comment 2 2016-11-08 22:55:21 PST
Jer Noble
Comment 3 2016-11-08 23:03:26 PST
Build Bot
Comment 4 2016-11-08 23:57:59 PST
Comment on attachment 294218 [details] Patch Attachment 294218 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/2481267 New failing tests: media/video-muted-audible-tracks.html media/video-background-tab-playback.html media/video-background-tab-visible-tracks.html
Build Bot
Comment 5 2016-11-08 23:58:03 PST
Created attachment 294220 [details] Archive of layout-test-results from ews103 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews103 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 6 2016-11-08 23:58:26 PST
Comment on attachment 294218 [details] Patch Attachment 294218 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/2481266 New failing tests: media/video-muted-audible-tracks.html media/video-background-tab-visible-tracks.html
Build Bot
Comment 7 2016-11-08 23:58:30 PST
Created attachment 294221 [details] Archive of layout-test-results from ews105 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews105 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Build Bot
Comment 8 2016-11-09 00:12:58 PST
Comment on attachment 294218 [details] Patch Attachment 294218 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/2481272 New failing tests: media/video-muted-audible-tracks.html media/video-background-tab-visible-tracks.html
Build Bot
Comment 9 2016-11-09 00:13:02 PST
Created attachment 294222 [details] Archive of layout-test-results from ews123 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews123 Port: ios-simulator-wk2 Platform: Mac OS X 10.11.6
Jer Noble
Comment 10 2016-11-09 09:55:44 PST
Build Bot
Comment 11 2016-11-09 10:56:02 PST
Comment on attachment 294232 [details] Patch Attachment 294232 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/2484214 New failing tests: media/video-muted-audible-tracks.html media/video-background-tab-visible-tracks.html
Build Bot
Comment 12 2016-11-09 10:56:06 PST
Created attachment 294238 [details] Archive of layout-test-results from ews103 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews103 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 13 2016-11-09 10:58:53 PST
Comment on attachment 294232 [details] Patch Attachment 294232 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/2484235 New failing tests: media/video-muted-audible-tracks.html media/video-background-tab-visible-tracks.html
Build Bot
Comment 14 2016-11-09 10:58:56 PST
Created attachment 294241 [details] Archive of layout-test-results from ews107 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Jer Noble
Comment 15 2016-11-09 11:11:20 PST
Build Bot
Comment 16 2016-11-09 12:11:44 PST
Comment on attachment 294249 [details] Patch Attachment 294249 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/2484535 New failing tests: media/video-background-tab-visible-tracks.html
Build Bot
Comment 17 2016-11-09 12:11:49 PST
Created attachment 294263 [details] Archive of layout-test-results from ews126 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews126 Port: ios-simulator-wk2 Platform: Mac OS X 10.11.6
Build Bot
Comment 18 2016-11-09 12:29:20 PST
Comment on attachment 294249 [details] Patch Attachment 294249 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/2484673 New failing tests: media/video-muted-audible-tracks.html
Build Bot
Comment 19 2016-11-09 12:29:24 PST
Created attachment 294265 [details] Archive of layout-test-results from ews100 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews100 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 20 2016-11-09 14:33:23 PST
Comment on attachment 294249 [details] Patch Attachment 294249 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/2485328 New failing tests: media/video-muted-audible-tracks.html
Build Bot
Comment 21 2016-11-09 14:33:26 PST
Created attachment 294291 [details] Archive of layout-test-results from ews113 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews113 Port: mac-yosemite Platform: Mac OS X 10.10.5
Sam Weinig
Comment 22 2016-11-10 11:20:41 PST
What happens to videos being drawn to canvases. Do they still work?
Jer Noble
Comment 23 2016-11-10 11:31:45 PST
(In reply to comment #22) > What happens to videos being drawn to canvases. Do they still work? No, they don't. If they're in the background they get black frames.
Sam Weinig
Comment 24 2016-11-11 13:08:53 PST
(In reply to comment #23) > (In reply to comment #22) > > What happens to videos being drawn to canvases. Do they still work? > > No, they don't. If they're in the background they get black frames. Seems like should still work, no?
Jer Noble
Comment 25 2016-11-14 09:39:38 PST
Build Bot
Comment 26 2016-11-14 10:49:30 PST
Comment on attachment 294707 [details] Patch Attachment 294707 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/2514693 New failing tests: media/video-muted-audible-tracks.html
Build Bot
Comment 27 2016-11-14 10:49:34 PST
Created attachment 294714 [details] Archive of layout-test-results from ews101 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 28 2016-11-14 10:49:54 PST
Comment on attachment 294707 [details] Patch Attachment 294707 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/2514657 New failing tests: media/video-muted-audible-tracks.html
Build Bot
Comment 29 2016-11-14 10:49:58 PST
Created attachment 294715 [details] Archive of layout-test-results from ews116 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews116 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 30 2016-11-14 10:56:02 PST
Comment on attachment 294707 [details] Patch Attachment 294707 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/2514665 New failing tests: media/video-background-tab-visible-tracks.html
Build Bot
Comment 31 2016-11-14 10:56:07 PST
Created attachment 294717 [details] Archive of layout-test-results from ews123 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews123 Port: ios-simulator-wk2 Platform: Mac OS X 10.11.6
Jer Noble
Comment 32 2016-11-14 11:02:57 PST
(In reply to comment #24) > (In reply to comment #23) > > (In reply to comment #22) > > > What happens to videos being drawn to canvases. Do they still work? > > > > No, they don't. If they're in the background they get black frames. > > Seems like should still work, no? No. There's no way to synchronously enable a track and paint it. We could hypothetically not disable tracks of videos that have been painted to a canvas, but we'd still not be able to synchronously paint a disabled track that has never before been painted, and since we paint videos when tab snapshots are taken, we'd likely never be able to disable videos in background tabs. The way I see it, this is similar to disabling/coalescing timers in background tabs. Page authors can't depend on foreground tab behavior continuing when their tab is backgrounded.
Jer Noble
Comment 33 2016-11-14 13:21:10 PST
Build Bot
Comment 34 2016-11-14 14:21:47 PST
Comment on attachment 294734 [details] Patch Attachment 294734 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/2515699 New failing tests: media/video-muted-audible-tracks.html media/nodesFromRect-shadowContent.html media/video-background-tab-visible-tracks.html media/muted-video-is-playing-audio.html
Build Bot
Comment 35 2016-11-14 14:21:51 PST
Created attachment 294744 [details] Archive of layout-test-results from ews103 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews103 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 36 2016-11-14 14:30:13 PST
Comment on attachment 294734 [details] Patch Attachment 294734 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/2515727 New failing tests: media/video-muted-audible-tracks.html media/nodesFromRect-shadowContent.html media/video-background-tab-visible-tracks.html media/muted-video-is-playing-audio.html
Build Bot
Comment 37 2016-11-14 14:30:17 PST
Created attachment 294750 [details] Archive of layout-test-results from ews107 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Build Bot
Comment 38 2016-11-14 14:31:45 PST
Comment on attachment 294734 [details] Patch Attachment 294734 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/2515689 New failing tests: media/video-muted-audible-tracks.html media/nodesFromRect-shadowContent.html media/video-background-tab-visible-tracks.html media/muted-video-is-playing-audio.html
Build Bot
Comment 39 2016-11-14 14:31:49 PST
Created attachment 294751 [details] Archive of layout-test-results from ews113 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews113 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 40 2016-11-14 14:44:05 PST
Comment on attachment 294734 [details] Patch Attachment 294734 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/2515752 New failing tests: media/video-muted-audible-tracks.html media/video-background-tab-visible-tracks.html media/muted-video-is-playing-audio.html
Build Bot
Comment 41 2016-11-14 14:44:10 PST
Created attachment 294753 [details] Archive of layout-test-results from ews123 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews123 Port: ios-simulator-wk2 Platform: Mac OS X 10.11.6
Jer Noble
Comment 42 2016-11-14 15:05:39 PST
Whoops. forgot to rebaseline.
Jer Noble
Comment 43 2016-11-15 15:55:07 PST
Build Bot
Comment 44 2016-11-15 17:02:31 PST
Comment on attachment 294891 [details] Patch Attachment 294891 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/2522558 New failing tests: media/nodesFromRect-shadowContent.html media/muted-video-is-playing-audio.html
Build Bot
Comment 45 2016-11-15 17:02:35 PST
Created attachment 294903 [details] Archive of layout-test-results from ews107 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Build Bot
Comment 46 2016-11-15 17:31:09 PST
Comment on attachment 294891 [details] Patch Attachment 294891 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/2522672 New failing tests: media/nodesFromRect-shadowContent.html media/muted-video-is-playing-audio.html
Build Bot
Comment 47 2016-11-15 17:31:13 PST
Created attachment 294908 [details] Archive of layout-test-results from ews102 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews102 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 48 2016-11-15 17:36:38 PST
Comment on attachment 294891 [details] Patch Attachment 294891 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/2522661 New failing tests: media/nodesFromRect-shadowContent.html media/muted-video-is-playing-audio.html
Build Bot
Comment 49 2016-11-15 17:36:42 PST
Created attachment 294909 [details] Archive of layout-test-results from ews115 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews115 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 50 2016-11-15 18:04:57 PST
Comment on attachment 294891 [details] Patch Attachment 294891 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/2522775 New failing tests: media/video-background-tab-visible-tracks.html
Build Bot
Comment 51 2016-11-15 18:05:03 PST
Created attachment 294910 [details] Archive of layout-test-results from ews124 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews124 Port: ios-simulator-wk2 Platform: Mac OS X 10.11.6
Gavin Barraclough
Comment 52 2016-11-15 23:41:15 PST
(In reply to comment #32) > (In reply to comment #24) > > (In reply to comment #23) > > > (In reply to comment #22) > > > > What happens to videos being drawn to canvases. Do they still work? > > > > > > No, they don't. If they're in the background they get black frames. > > > > Seems like should still work, no? > > No. > > There's no way to synchronously enable a track and paint it. We could > hypothetically not disable tracks of videos that have been painted to a > canvas, but we'd still not be able to synchronously paint a disabled track > that has never before been painted, and since we paint videos when tab > snapshots are taken, we'd likely never be able to disable videos in > background tabs. > > The way I see it, this is similar to disabling/coalescing timers in > background tabs. Page authors can't depend on foreground tab behavior > continuing when their tab is backgrounded. Agreed. If our choices are: [1] Continue decoding video frames in background tabs. [2] Stop decoding video frames in background tabs, continue everything else. [3] Stop decoding video frames in background tabs, stop everything else. We should test [2] for web compatibility. [1] is bad for CPU, memory, battery usage. [2] is better than [3] if we believe there is value in running background tabs at all.
Sam Weinig
Comment 53 2016-11-16 12:05:35 PST
(In reply to comment #32) > (In reply to comment #24) > > (In reply to comment #23) > > > (In reply to comment #22) > > > > What happens to videos being drawn to canvases. Do they still work? > > > > > > No, they don't. If they're in the background they get black frames. > > > > Seems like should still work, no? > > No. > > There's no way to synchronously enable a track and paint it. We could > hypothetically not disable tracks of videos that have been painted to a > canvas, but we'd still not be able to synchronously paint a disabled track > that has never before been painted, and since we paint videos when tab > snapshots are taken, we'd likely never be able to disable videos in > background tabs. > > The way I see it, this is similar to disabling/coalescing timers in > background tabs. Page authors can't depend on foreground tab behavior > continuing when their tab is backgrounded. I don't think these are exactly the same. Imagine a page that is doing some kind of image analysis on a video. Going into a background tab should not break that functionality. Timer throttling might slow something down, but it won't change the result.
Jer Noble
Comment 54 2016-11-28 15:02:03 PST
(In reply to comment #53) > I don't think these are exactly the same. Imagine a page that is doing some > kind of image analysis on a video. Going into a background tab should not > break that functionality. Timer throttling might slow something down, but it > won't change the result. That's not really true, especially with your image analysis example. If the page is playing a video in a background tab and doing analysis on the output, it's going to set a timer to fire at the frame rate of the video, e.g. 24 times per second. If timers are being throttled, the page is definitely going to miss decoded frames, which is functionally equivalent to those frames never being decoded.
Brady Eidson
Comment 55 2018-02-14 10:35:44 PST
Comment on attachment 294891 [details] Patch Patches that have been up for review since 2016 are almost certainly too stale to be relevant to trunk in their current form. If this patch is still important please rebase it and post it for review again.
Note You need to log in before you can comment on or make changes to this bug.