Title: [275821] trunk
Revision
275821
Author
[email protected]
Date
2021-04-12 06:41:38 -0700 (Mon, 12 Apr 2021)

Log Message

[MSE][GStreamer] Crash in WebCore::PlaybackPipeline::addSourceBuffer when setting duration and preload is set to none
https://bugs.webkit.org/show_bug.cgi?id=224260

Patch by Philippe Normand <[email protected]> on 2021-04-12
Reviewed by Xabier Rodriguez-Calvar.

Source/WebCore:

Disable delayed loading for the GStreamer MSE player, we want the MSE source element to be
configured ASAP, otherwise the playback pipeline will fail in various ways (duration
notifications sent too early, crashes in addSourceBuffer, crashes in attachTracks, and so
on).

Test: media/media-source/media-source-no-preload-set-duration-crash.html

* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged):

LayoutTests:

* media/media-source/media-source-no-preload-set-duration-crash-expected.txt: Added.
* media/media-source/media-source-no-preload-set-duration-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (275820 => 275821)


--- trunk/LayoutTests/ChangeLog	2021-04-12 13:23:08 UTC (rev 275820)
+++ trunk/LayoutTests/ChangeLog	2021-04-12 13:41:38 UTC (rev 275821)
@@ -1,3 +1,13 @@
+2021-04-12  Philippe Normand  <[email protected]>
+
+        [MSE][GStreamer] Crash in WebCore::PlaybackPipeline::addSourceBuffer when setting duration and preload is set to none
+        https://bugs.webkit.org/show_bug.cgi?id=224260
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        * media/media-source/media-source-no-preload-set-duration-crash-expected.txt: Added.
+        * media/media-source/media-source-no-preload-set-duration-crash.html: Added.
+
 2021-04-12  Youenn Fablet  <[email protected]>
 
         Make sure all frames get transformed when overriding a transform with another one

Added: trunk/LayoutTests/media/media-source/media-source-no-preload-set-duration-crash-expected.txt (0 => 275821)


--- trunk/LayoutTests/media/media-source/media-source-no-preload-set-duration-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-no-preload-set-duration-crash-expected.txt	2021-04-12 13:41:38 UTC (rev 275821)
@@ -0,0 +1,9 @@
+
+RUN(video.src = ""
+EVENT(sourceopen)
+Setting duration when preload is disabled should trigger no crash.
+RUN(source.duration = 42)
+Adding a SourceBuffer when preload is disabled should trigger no crash.
+RUN(sourceBuffer = source.addSourceBuffer(loader.type()))
+END OF TEST
+

Added: trunk/LayoutTests/media/media-source/media-source-no-preload-set-duration-crash.html (0 => 275821)


--- trunk/LayoutTests/media/media-source/media-source-no-preload-set-duration-crash.html	                        (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-no-preload-set-duration-crash.html	2021-04-12 13:41:38 UTC (rev 275821)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>media-source-no-preload-set-duration-crash</title>
+    <script src=""
+    <script src=""
+    <script>
+    var loader;
+    var source;
+
+    function runTest() {
+        findMediaElement();
+
+        loader = new MediaSourceLoader('content/test-fragmented-manifest.json');
+        loader._onload_ = mediaDataLoaded;
+    }
+
+    function mediaDataLoaded() {
+        source = new MediaSource();
+        waitForEvent('sourceopen', sourceOpen, false, false, source);
+        run('video.src = ""
+    }
+
+    function sourceOpen() {
+        consoleWrite('Setting duration when preload is disabled should trigger no crash.');
+        run('source.duration = 42');
+        consoleWrite('Adding a SourceBuffer when preload is disabled should trigger no crash.');
+        run('sourceBuffer = source.addSourceBuffer(loader.type())');
+        endTest();
+    }
+    </script>
+</head>
+<body _onload_="runTest()">
+    <video preload="none"></video>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (275820 => 275821)


--- trunk/Source/WebCore/ChangeLog	2021-04-12 13:23:08 UTC (rev 275820)
+++ trunk/Source/WebCore/ChangeLog	2021-04-12 13:41:38 UTC (rev 275821)
@@ -1,3 +1,20 @@
+2021-04-12  Philippe Normand  <[email protected]>
+
+        [MSE][GStreamer] Crash in WebCore::PlaybackPipeline::addSourceBuffer when setting duration and preload is set to none
+        https://bugs.webkit.org/show_bug.cgi?id=224260
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        Disable delayed loading for the GStreamer MSE player, we want the MSE source element to be
+        configured ASAP, otherwise the playback pipeline will fail in various ways (duration
+        notifications sent too early, crashes in addSourceBuffer, crashes in attachTracks, and so
+        on).
+
+        Test: media/media-source/media-source-no-preload-set-duration-crash.html
+
+        * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged):
+
 2021-04-12  Youenn Fablet  <[email protected]>
 
         Make sure all frames get transformed when overriding a transform with another one

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (275820 => 275821)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-04-12 13:23:08 UTC (rev 275820)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-04-12 13:41:38 UTC (rev 275821)
@@ -328,7 +328,7 @@
     setPlaybinURL(url);
 
     GST_DEBUG_OBJECT(pipeline(), "preload: %s", convertEnumerationToString(m_preload).utf8().data());
-    if (m_preload == MediaPlayer::Preload::None) {
+    if (m_preload == MediaPlayer::Preload::None && !isMediaSource()) {
         GST_INFO_OBJECT(pipeline(), "Delaying load.");
         m_isDelayingLoad = true;
     }

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/PlaybackPipeline.cpp (275820 => 275821)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/PlaybackPipeline.cpp	2021-04-12 13:23:08 UTC (rev 275820)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/PlaybackPipeline.cpp	2021-04-12 13:41:38 UTC (rev 275821)
@@ -103,6 +103,7 @@
 
 MediaSourcePrivate::AddStatus PlaybackPipeline::addSourceBuffer(RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivate)
 {
+    ASSERT(m_webKitMediaSrc);
     WebKitMediaSrcPrivate* priv = m_webKitMediaSrc->priv;
 
     if (priv->allTracksConfigured) {
@@ -258,6 +259,7 @@
 
 void PlaybackPipeline::notifyDurationChanged()
 {
+    ASSERT(m_webKitMediaSrc);
     gst_element_post_message(GST_ELEMENT(m_webKitMediaSrc.get()), gst_message_new_duration_changed(GST_OBJECT(m_webKitMediaSrc.get())));
     // WebKitMediaSrc will ask MediaPlayerPrivateGStreamerMSE for the new duration later, when somebody asks for it.
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to