Summary: | [GStreamer] Constant CPU usage on autoplaying videos, even when out of viewport | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Jeff Fortin <nekohayo> | ||||||
Component: | WebKitGTK | Assignee: | Philippe Normand <philn> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | bugs-noreply, philn | ||||||
Priority: | P2 | Keywords: | Performance | ||||||
Version: | WebKit Nightly Build | ||||||||
Hardware: | PC | ||||||||
OS: | Linux | ||||||||
Bug Depends on: | |||||||||
Bug Blocks: | 245783 | ||||||||
Attachments: |
|
Description
Jeff Fortin
2023-04-28 21:32:32 PDT
Created attachment 466135 [details]
sysprof capture
Created attachment 466136 [details]
sysprof screenshot
I forgot to mention: this is vanilla Epiphany 44.2 from Fedora 38, without doing anything to make it use VA-API HW video decoding acceleration, so it's probably doing everything on the CPU... but I don't see why it would keep doing that once the video playback is stopped. ...and to be clear, the video I am talking about in this page is the 1st video at the very top, that is as part of the banner's background, and is autoplaying on loop silently on load; I was not referring to the 2nd video in the middle of the height of the page (that you have scroll to and click to play), though maybe that one would also exhibit the issue, I don't know. This page loads not one, but 4 videos: - the one you reported the issue about, the interview. MSE, from Vimeo - 3 videos stored on a old-fashioned HTTP server, playing in loop: * https://interbrand.com/wp-content/uploads/2022/10/data-animation_apple_v04.mp4 * https://interbrand.com/wp-content/uploads/2022/10/GE.mp4.mp4 * https://interbrand.com/wp-content/uploads/2022/10/crop-piezas-2.mp4 So even if you pause the first one, the 3 others keep playing... That's what using your CPU, most likely. And unlikely I doubt we can do anything about it... Interesting! Could their playback be automatically stopped when they are not in the currently visible view, however? There's probably no reason to play them off-screen if they're not WebRTC, especially if they are muted or silent? Maybe yes. Likely related, MediaPlayerPrivate methods we should(?) override: virtual void setPageIsVisible(bool) = 0; virtual void setVisibleForCanvas(bool visible) { setPageIsVisible(visible); } virtual void setVisibleInViewport(bool) { } (In reply to Jeff Fortin from comment #6) > Interesting! Could their playback be automatically stopped when they are not > in the currently visible view, however? It's technically possible but UX-wise, huh, terrible? Imagine loading some YT video, start playing it and then scroll down to read the comments, the video would pause... your CPU would be happier, but would you? I'm not sure that'd be a great idea? I'm talking about silent or muted videos here, those should never be playing offscreen (or when the tab is unfocused, or when the window/app is unfocused). Playing videos that have sound, of course, would be expected to keep playing until stopped by the user (or the video reaches the end). I've got a WIP patch, needs a bit more testing. Pull request: https://github.com/WebKit/WebKit/pull/13549 Committed 264017@main (0218f0f88a9c): <https://commits.webkit.org/264017@main> Reviewed commits have been landed. Closing PR #13549 and removing active labels. |