[Webkit-unassigned] [Bug 274261] [GTK] Excessive CPU usage from cached web process after closing nbcnews.com page, failure to display web content after reopening page

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri May 17 12:45:39 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=274261

--- Comment #2 from Michael Catanzaro <mcatanzaro at redhat.com> ---
f91aeb92bd8ee8b8f6d7242afad4e07d5bfff6f3 is the first bad commit
commit f91aeb92bd8ee8b8f6d7242afad4e07d5bfff6f3 (HEAD)
Author: Carlos Bentzen <cadubentzen at igalia.com>
Date:   Thu Mar 28 13:24:38 2024 -0700

    [GStreamer][MSE] Crash in webKitMediaSrcStreamFlush
    https://bugs.webkit.org/show_bug.cgi?id=260455

    Reviewed by Alicia Boya Garcia.

    Fix crash and playback of video on https://www.apple.com/apple-watch-ultra-2/.
    The video starts outside of the viewport and is played via MSE.

    The issue was caused due to failing to transition the pipeline to PAUSED in
    MediaPlayerPrivateGStreamer::setVisibleInViewport when an MSE video starts initially
    outside of the viewport. That, in turn, is caused because we try to set playbin
    to PAUSED without an URL set. Then, the media player pipeline gets stuck in READY,
    while webkitmediasrc is in the PAUSED state. With this, the video never starts playing
    back.

    Moreover, scrolling the page for the video to be in and out of the viewport, it triggers
    a downgrade state in webkitmediasrc to READY, which if coupled with a seek attempt then
    causes a crash in WebKitMediaSourceGStreamer when flushing.

    The fix is two-fold:
    1. Avoid setting the state to PAUSED if no playbin URL has been set.
    2. Avoid setting the state of the pipeline to READY in
       MediaPlayerPrivateGStreamer::setVisibleInViewport if the media player is MSE.

    Added a test that triggers the described behavior and crashes without the fix. It scrolls
    the page to move a video in and out of the viewport, while also seeking to the start on
    every scroll. Currently, part of the code to trigger the crash isn't executed
    due to WEBKIT_GST_ALLOW_PLAYBACK_OF_INVISIBLE_VIDEOS=1 being set in the test driver in
    Tools/Scripts/webkitpy/port/glib.py (264017 at main), which needs to be commented manually.
    We should find a way to add a test preference for this code path to be enabled.

    * LayoutTests/media/media-source/media-source-muted-scroll-and-seek-crash-expected.txt: Added.
    * LayoutTests/media/media-source/media-source-muted-scroll-and-seek-crash.html: Added.
    * Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
    (WebCore::MediaPlayerPrivateGStreamer::load): Set playbin URL before calling setVisibleInViewport.
    (WebCore::MediaPlayerPrivateGStreamer::setVisibleInViewport): Avoid state transitions to READY if MSE
    and avoid setting the pipeline to PAUSED if playbin URL is not set.

    Canonical link: https://commits.webkit.org/276798@main

 LayoutTests/media/media-source/media-source-muted-scroll-and-seek-crash-expected.txt |  4 ++++
 LayoutTests/media/media-source/media-source-muted-scroll-and-seek-crash.html         | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp           | 14 +++++++++++---
 3 files changed, 80 insertions(+), 3 deletions(-)
 create mode 100644 LayoutTests/media/media-source/media-source-muted-scroll-and-seek-crash-expected.txt
 create mode 100644 LayoutTests/media/media-source/media-source-muted-scroll-and-seek-crash.html

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240517/e00cc335/attachment-0001.htm>


More information about the webkit-unassigned mailing list