[MSE][GStreamer] Ignore caps notifications when tearing down the pipeline
authoraboya@igalia.com <aboya@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Nov 2018 18:14:43 +0000 (18:14 +0000)
committeraboya@igalia.com <aboya@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Nov 2018 18:14:43 +0000 (18:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191578

Reviewed by Xabier Rodriguez-Calvar.

Changing the demuxer to READY state (which is done only in the main
thread) triggers the unlinking of its srcpads, which in turns emits a
caps change notification in the previously linked element since they
become unnegotiated again.

We are not interested in caps notifications in these cases, so let's
just ignore caps notifications emitted from the main thread.

This fixes an assertion failure in the debug builds.

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238287 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp

index c6bc366..4ee6b56 100644 (file)
@@ -1,3 +1,23 @@
+2018-11-16  Alicia Boya GarcĂ­a  <aboya@igalia.com>
+
+        [MSE][GStreamer] Ignore caps notifications when tearing down the pipeline
+        https://bugs.webkit.org/show_bug.cgi?id=191578
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        Changing the demuxer to READY state (which is done only in the main
+        thread) triggers the unlinking of its srcpads, which in turns emits a
+        caps change notification in the previously linked element since they
+        become unnegotiated again.
+
+        We are not interested in caps notifications in these cases, so let's
+        just ignore caps notifications emitted from the main thread.
+
+        This fixes an assertion failure in the debug builds.
+
+        * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
+        (WebCore::AppendPipeline::AppendPipeline):
+
 2018-11-16  Sihui Liu  <sihui_liu@apple.com>
 
         Storing blobs in IDB on iOS: "Error preparing blob/file"
index 1b7b4a2..f55e00e 100644 (file)
@@ -159,6 +159,17 @@ AppendPipeline::AppendPipeline(Ref<MediaSourceClientGStreamerMSE> mediaSourceCli
 
     GRefPtr<GstPad> appsinkPad = adoptGRef(gst_element_get_static_pad(m_appsink.get(), "sink"));
     g_signal_connect(appsinkPad.get(), "notify::caps", G_CALLBACK(+[](GObject*, GParamSpec*, AppendPipeline* appendPipeline) {
+        if (isMainThread()) {
+            // When changing the pipeline state down to READY the demuxer is unlinked and this triggers a caps notification
+            // because the appsink loses its previously negotiated caps. We are not interested in these unnegotiated caps.
+#ifndef NDEBUG
+            GRefPtr<GstPad> pad = adoptGRef(gst_element_get_static_pad(appendPipeline->m_appsink.get(), "sink"));
+            GRefPtr<GstCaps> caps = adoptGRef(gst_pad_get_current_caps(pad.get()));
+            ASSERT(!caps);
+#endif
+            return;
+        }
+
         appendPipeline->m_taskQueue.enqueueTask([appendPipeline]() {
             appendPipeline->appsinkCapsChanged();
         });