Title: [233797] trunk/Source/WebCore
Revision
233797
Author
calva...@igalia.com
Date
2018-07-13 03:47:10 -0700 (Fri, 13 Jul 2018)

Log Message

[GStreamer][MSE] Add GstFlowCombiner to handle non-linked inactive branches
https://bugs.webkit.org/show_bug.cgi?id=187636

Reviewed by Carlos Garcia Campos.

When we have more than one source buffer, only one will be
rendered and the inactive branch will report linking errors that
we have to deal with.

* platform/graphics/gstreamer/GUniquePtrGStreamer.h: Added GstFlowCombiner.
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
(webkitMediaSrcChain): Combine the flow in the flow combiner.
(webkit_media_src_init): Initialize the flow combiner.
(webKitMediaSrcLinkStreamToSrcPad): Add the proxypad to the
combiner and set the chain function.
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamerPrivate.h:
Declare the flow combiner.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (233796 => 233797)


--- trunk/Source/WebCore/ChangeLog	2018-07-13 08:10:51 UTC (rev 233796)
+++ trunk/Source/WebCore/ChangeLog	2018-07-13 10:47:10 UTC (rev 233797)
@@ -1,3 +1,23 @@
+2018-07-13  Xabier Rodriguez Calvar  <calva...@igalia.com>
+
+        [GStreamer][MSE] Add GstFlowCombiner to handle non-linked inactive branches
+        https://bugs.webkit.org/show_bug.cgi?id=187636
+
+        Reviewed by Carlos Garcia Campos.
+
+        When we have more than one source buffer, only one will be
+        rendered and the inactive branch will report linking errors that
+        we have to deal with.
+
+        * platform/graphics/gstreamer/GUniquePtrGStreamer.h: Added GstFlowCombiner.
+        * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
+        (webkitMediaSrcChain): Combine the flow in the flow combiner.
+        (webkit_media_src_init): Initialize the flow combiner.
+        (webKitMediaSrcLinkStreamToSrcPad): Add the proxypad to the
+        combiner and set the chain function.
+        * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamerPrivate.h:
+        Declare the flow combiner.
+
 2018-07-13  Charlie Turner  <ctur...@igalia.com>
 
         [GStreamer] Add GstBufferMapped abstraction

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GUniquePtrGStreamer.h (233796 => 233797)


--- trunk/Source/WebCore/platform/graphics/gstreamer/GUniquePtrGStreamer.h	2018-07-13 08:10:51 UTC (rev 233796)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GUniquePtrGStreamer.h	2018-07-13 10:47:10 UTC (rev 233797)
@@ -21,6 +21,7 @@
 #define GUniquePtrGStreamer_h
 #if USE(GSTREAMER)
 
+#include <gst/base/gstflowcombiner.h>
 #include <gst/gstsegment.h>
 #include <gst/gststructure.h>
 #include <gst/pbutils/install-plugins.h>
@@ -31,6 +32,7 @@
 WTF_DEFINE_GPTR_DELETER(GstStructure, gst_structure_free)
 WTF_DEFINE_GPTR_DELETER(GstInstallPluginsContext, gst_install_plugins_context_free)
 WTF_DEFINE_GPTR_DELETER(GstSegment, gst_segment_free)
+WTF_DEFINE_GPTR_DELETER(GstFlowCombiner, gst_flow_combiner_free)
 
 }
 

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp (233796 => 233797)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp	2018-07-13 08:10:51 UTC (rev 233796)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp	2018-07-13 10:47:10 UTC (rev 233797)
@@ -48,7 +48,6 @@
 #include <gst/video/video.h>
 #include <wtf/Condition.h>
 #include <wtf/MainThread.h>
-#include <wtf/glib/GUniquePtr.h>
 #include <wtf/text/CString.h>
 
 GST_DEBUG_CATEGORY_STATIC(webkit_media_src_debug);
@@ -249,6 +248,13 @@
     g_type_class_add_private(klass, sizeof(WebKitMediaSrcPrivate));
 }
 
+static GstFlowReturn webkitMediaSrcChain(GstPad* pad, GstObject* parent, GstBuffer* buffer)
+{
+    GRefPtr<WebKitMediaSrc> self = adoptGRef(WEBKIT_MEDIA_SRC(gst_object_get_parent(parent)));
+
+    return gst_flow_combiner_update_pad_flow(self->priv->flowCombiner.get(), pad, gst_proxy_pad_chain_default(pad, GST_OBJECT(self.get()), buffer));
+}
+
 static void webkit_media_src_init(WebKitMediaSrc* source)
 {
     source->priv = WEBKIT_MEDIA_SRC_GET_PRIVATE(source);
@@ -257,6 +263,7 @@
     source->priv->appsrcSeekDataCount = 0;
     source->priv->appsrcNeedDataCount = 0;
     source->priv->appsrcSeekDataNextAction = Nothing;
+    source->priv->flowCombiner = GUniquePtr<GstFlowCombiner>(gst_flow_combiner_new());
 
     // No need to reset Stream.appsrcNeedDataFlag because there are no Streams at this point yet.
 }
@@ -474,6 +481,9 @@
     GUniquePtr<gchar> padName(g_strdup_printf("src_%u", padId));
     GstPad* ghostpad = WebCore::webkitGstGhostPadFromStaticTemplate(&srcTemplate, padName.get(), sourcePad);
 
+    auto proxypad = adoptGRef(GST_PAD(gst_proxy_pad_get_internal(GST_PROXY_PAD(ghostpad))));
+    gst_flow_combiner_add_pad(stream->parent->priv->flowCombiner.get(), proxypad.get());
+    gst_pad_set_chain_function(proxypad.get(), static_cast<GstPadChainFunction>(webkitMediaSrcChain));
     gst_pad_set_query_function(ghostpad, webKitMediaSrcQueryWithParent);
 
     gst_pad_set_active(ghostpad, TRUE);

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamerPrivate.h (233796 => 233797)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamerPrivate.h	2018-07-13 08:10:51 UTC (rev 233796)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamerPrivate.h	2018-07-13 10:47:10 UTC (rev 233797)
@@ -23,6 +23,7 @@
 #if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(MEDIA_SOURCE)
 
 #include "AudioTrackPrivateGStreamer.h"
+#include "GUniquePtrGStreamer.h"
 #include "SourceBufferPrivateGStreamer.h"
 #include "VideoTrackPrivateGStreamer.h"
 #include "WebKitMediaSourceGStreamer.h"
@@ -121,6 +122,8 @@
 
     GRefPtr<GstBus> bus;
     WebCore::MediaPlayerPrivateGStreamerMSE* mediaPlayerPrivate;
+
+    GUniquePtr<GstFlowCombiner> flowCombiner;
 };
 
 extern guint webKitMediaSrcSignals[LAST_SIGNAL];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to