WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
256123
[GStreamer] Constant CPU usage on autoplaying videos, even when out of viewport
https://bugs.webkit.org/show_bug.cgi?id=256123
Summary
[GStreamer] Constant CPU usage on autoplaying videos, even when out of viewport
Jeff Fortin
Reported
2023-04-28 21:32:32 PDT
Test case:
https://interbrand.com
and its autoplaying video, since Epiphany 44.2 defaults to allowing muted autoplaying video. 1. Load that page. See the video playing. 2. Pause video playback using their pause button next to the unmute button. Result: with WebKitGTK 2.40.1 and GStreamer 1.22.2, even on a modern 8-logical-CPUs 8th-generation Intel Kabylake CPU+GPU running on Wayland with triplebuffering, even with playback paused, CPU usage continues at 35 to 50% of all cores, and the cores stay clocked around 2.4-2.5 GHz instead of going back down to 800 Mhz.
Attachments
sysprof capture
(1.11 MB, application/x-xz)
2023-04-28 21:38 PDT
,
Jeff Fortin
no flags
Details
sysprof screenshot
(221.33 KB, image/png)
2023-04-28 21:39 PDT
,
Jeff Fortin
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Jeff Fortin
Comment 1
2023-04-28 21:38:57 PDT
Created
attachment 466135
[details]
sysprof capture
Jeff Fortin
Comment 2
2023-04-28 21:39:22 PDT
Created
attachment 466136
[details]
sysprof screenshot
Jeff Fortin
Comment 3
2023-04-28 21:42:03 PDT
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.
Jeff Fortin
Comment 4
2023-04-29 06:30:58 PDT
...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.
Philippe Normand
Comment 5
2023-04-29 07:14:57 PDT
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...
Jeff Fortin
Comment 6
2023-04-29 07:28:26 PDT
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?
Philippe Normand
Comment 7
2023-04-29 10:39:26 PDT
Maybe yes.
Philippe Normand
Comment 8
2023-04-29 10:43:11 PDT
Likely related, MediaPlayerPrivate methods we should(?) override: virtual void setPageIsVisible(bool) = 0; virtual void setVisibleForCanvas(bool visible) { setPageIsVisible(visible); } virtual void setVisibleInViewport(bool) { }
Philippe Normand
Comment 9
2023-04-30 03:52:00 PDT
(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?
Jeff Fortin
Comment 10
2023-04-30 05:44:29 PDT
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).
Philippe Normand
Comment 11
2023-04-30 11:55:28 PDT
I've got a WIP patch, needs a bit more testing.
Philippe Normand
Comment 12
2023-05-07 03:25:56 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/13549
EWS
Comment 13
2023-05-12 08:30:36 PDT
Committed
264017@main
(0218f0f88a9c): <
https://commits.webkit.org/264017@main
> Reviewed commits have been landed. Closing PR #13549 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug