Title: [275029] releases/WebKitGTK/webkit-2.32/Source/WebCore
Revision
275029
Author
[email protected]
Date
2021-03-25 07:07:25 -0700 (Thu, 25 Mar 2021)

Log Message

Merge r274943 - [GStreamer] Use imxvideoconvert_g2d element inside the sink when available
https://bugs.webkit.org/show_bug.cgi?id=223693

Patch by Zan Dobersek <[email protected]> on 2021-03-24
Reviewed by Philippe Normand.

On some iMX platforms we require the use of imxvideoconvert_g2d element
in order to properly convert the visual buffers before they can be
rendered through our pipeline. We expect to require this buffer if it's
present in the GStreamer plugin registry on the system.

We search for this element and, if found, add it to the sink and
position it at the beginning, before the glupload element.

Based on an approach outlined by Gabriel Valcazar.

* platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
(webKitGLVideoSinkConstructed):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog (275028 => 275029)


--- releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog	2021-03-25 14:07:20 UTC (rev 275028)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog	2021-03-25 14:07:25 UTC (rev 275029)
@@ -1,3 +1,23 @@
+2021-03-24  Zan Dobersek  <[email protected]>
+
+        [GStreamer] Use imxvideoconvert_g2d element inside the sink when available
+        https://bugs.webkit.org/show_bug.cgi?id=223693
+
+        Reviewed by Philippe Normand.
+
+        On some iMX platforms we require the use of imxvideoconvert_g2d element
+        in order to properly convert the visual buffers before they can be
+        rendered through our pipeline. We expect to require this buffer if it's
+        present in the GStreamer plugin registry on the system.
+
+        We search for this element and, if found, add it to the sink and
+        position it at the beginning, before the glupload element.
+
+        Based on an approach outlined by Gabriel Valcazar.
+
+        * platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
+        (webKitGLVideoSinkConstructed):
+
 2021-03-24  Philippe Normand  <[email protected]>
 
         REGRESSION(r274870) fast/canvas/webgl/texImage2D-mse-flipY-true.html and fast/canvas/webgl/texImage2D-mse-flipY-false.html are crashing

Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp (275028 => 275029)


--- releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp	2021-03-25 14:07:20 UTC (rev 275028)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp	2021-03-25 14:07:25 UTC (rev 275029)
@@ -68,6 +68,17 @@
     ASSERT(sink->priv->appSink);
     g_object_set(sink->priv->appSink.get(), "enable-last-sample", FALSE, "emit-signals", TRUE, "max-buffers", 1, nullptr);
 
+    auto* imxVideoConvertG2D =
+        []() -> GstElement*
+        {
+            auto elementFactor = adoptGRef(gst_element_factory_find("imxvideoconvert_g2d"));
+            if (elementFactor)
+                return gst_element_factory_create(elementFactor.get(), nullptr);
+            return nullptr;
+        }();
+    if (imxVideoConvertG2D)
+        gst_bin_add(GST_BIN_CAST(sink), imxVideoConvertG2D);
+
     GstElement* upload = gst_element_factory_make("glupload", nullptr);
     GstElement* colorconvert = gst_element_factory_make("glcolorconvert", nullptr);
     ASSERT(upload);
@@ -96,9 +107,17 @@
     gst_caps_set_features(caps.get(), 0, gst_caps_features_new(GST_CAPS_FEATURE_MEMORY_GL_MEMORY, nullptr));
     g_object_set(sink->priv->appSink.get(), "caps", caps.get(), nullptr);
 
+    if (imxVideoConvertG2D)
+        gst_element_link(imxVideoConvertG2D, upload);
     gst_element_link_many(upload, colorconvert, sink->priv->appSink.get(), nullptr);
 
-    GRefPtr<GstPad> pad = adoptGRef(gst_element_get_static_pad(upload, "sink"));
+    GstElement* sinkElement =
+        [&] {
+            if (imxVideoConvertG2D)
+                return imxVideoConvertG2D;
+            return upload;
+        }();
+    GRefPtr<GstPad> pad = adoptGRef(gst_element_get_static_pad(sinkElement, "sink"));
     gst_element_add_pad(GST_ELEMENT_CAST(sink), gst_ghost_pad_new("sink", pad.get()));
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to