Title: [277090] releases/WebKitGTK/webkit-2.32/Source/WebCore
Revision
277090
Author
[email protected]
Date
2021-05-06 08:30:45 -0700 (Thu, 06 May 2021)

Log Message

Merge r277088 - [GStreamer] Fallback to texture mapper video orientation handling when glvideoflip is not available
https://bugs.webkit.org/show_bug.cgi?id=225454

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

r275412 introduced a new runtime dependency on gst-plugins-good's glvideoflip element, which
is not desirable for the 2.32 branch. This patch let's the player handle rotation tags if
the glvideoflip element wasn't found at runtime. Ideally we should probably not rely on
glvideoflip in the first place as it might induce a performance impact, to be handled in a
follow-up patch.

* platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
(webKitGLVideoSinkConstructed):
(webKitGLVideoSinkGetProperty):
(webkit_gl_video_sink_class_init):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::createVideoSinkGL):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog (277089 => 277090)


--- releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog	2021-05-06 15:24:22 UTC (rev 277089)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog	2021-05-06 15:30:45 UTC (rev 277090)
@@ -1,3 +1,23 @@
+2021-05-06  Philippe Normand  <[email protected]>
+
+        [GStreamer] Fallback to texture mapper video orientation handling when glvideoflip is not available
+        https://bugs.webkit.org/show_bug.cgi?id=225454
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        r275412 introduced a new runtime dependency on gst-plugins-good's glvideoflip element, which
+        is not desirable for the 2.32 branch. This patch let's the player handle rotation tags if
+        the glvideoflip element wasn't found at runtime. Ideally we should probably not rely on
+        glvideoflip in the first place as it might induce a performance impact, to be handled in a
+        follow-up patch.
+
+        * platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
+        (webKitGLVideoSinkConstructed):
+        (webKitGLVideoSinkGetProperty):
+        (webkit_gl_video_sink_class_init):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::createVideoSinkGL):
+
 2021-05-05  Carlos Garcia Campos  <[email protected]>
 
         [SOUP] Wrong cookie timestamp in case of long expire time

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


--- releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp	2021-05-06 15:24:22 UTC (rev 277089)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp	2021-05-06 15:30:45 UTC (rev 277090)
@@ -40,6 +40,7 @@
 enum {
     PROP_0,
     PROP_STATS,
+    PROP_HANDLES_ROTATION_TAGS,
     PROP_LAST
 };
 
@@ -46,6 +47,7 @@
 struct _WebKitGLVideoSinkPrivate {
     GRefPtr<GstElement> appSink;
     MediaPlayerPrivateGStreamer* mediaPlayerPrivate;
+    bool handlesRotationTags;
 };
 
 GST_DEBUG_CATEGORY_STATIC(webkit_gl_video_sink_debug);
@@ -81,13 +83,18 @@
 
     GstElement* upload = gst_element_factory_make("glupload", nullptr);
     GstElement* colorconvert = gst_element_factory_make("glcolorconvert", nullptr);
+
     GstElement* videoFlip = gst_element_factory_make("glvideoflip", nullptr);
-    gst_util_set_object_arg(G_OBJECT(videoFlip), "method", "automatic");
+    sink->priv->handlesRotationTags = videoFlip;
 
+    if (videoFlip) {
+        gst_util_set_object_arg(G_OBJECT(videoFlip), "method", "automatic");
+        gst_bin_add(GST_BIN_CAST(sink), videoFlip);
+    }
+
     ASSERT(upload);
     ASSERT(colorconvert);
-    ASSERT(videoFlip);
-    gst_bin_add_many(GST_BIN_CAST(sink), upload, colorconvert, videoFlip, sink->priv->appSink.get(), nullptr);
+    gst_bin_add_many(GST_BIN_CAST(sink), upload, colorconvert, sink->priv->appSink.get(), nullptr);
 
     // Workaround until we can depend on GStreamer 1.16.2.
     // https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/commit/8d32de090554cf29fe359f83aa46000ba658a693
@@ -113,8 +120,13 @@
 
     if (imxVideoConvertG2D)
         gst_element_link(imxVideoConvertG2D, upload);
-    gst_element_link_many(upload, colorconvert, videoFlip, sink->priv->appSink.get(), nullptr);
+    gst_element_link(upload, colorconvert);
 
+    if (videoFlip)
+        gst_element_link_many(colorconvert, videoFlip, sink->priv->appSink.get(), nullptr);
+    else
+        gst_element_link(colorconvert, sink->priv->appSink.get());
+
     GstElement* sinkElement =
         [&] {
             if (imxVideoConvertG2D)
@@ -208,6 +220,9 @@
             gst_value_set_structure(value, stats.get());
         }
         break;
+    case PROP_HANDLES_ROTATION_TAGS:
+        g_value_set_boolean(value, sink->priv->handlesRotationTags);
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, paramSpec);
         RELEASE_ASSERT_NOT_REACHED();
@@ -230,6 +245,9 @@
     g_object_class_install_property(objectClass, PROP_STATS, g_param_spec_boxed("stats", "Statistics",
         "Sink Statistics", GST_TYPE_STRUCTURE, static_cast<GParamFlags>(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
 
+    g_object_class_install_property(objectClass, PROP_HANDLES_ROTATION_TAGS, g_param_spec_boolean("handles-rotation-tags", "Handles Rotation Tags",
+        "True if the sink is relying on glvideoflip to handle frame rotation", FALSE, static_cast<GParamFlags>(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
+
     elementClass->change_state = GST_DEBUG_FUNCPTR(webKitGLVideoSinkChangeState);
 }
 

Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (277089 => 277090)


--- releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-05-06 15:24:22 UTC (rev 277089)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-05-06 15:30:45 UTC (rev 277090)
@@ -3368,6 +3368,11 @@
     GstElement* sink = gst_element_factory_make("webkitglvideosink", nullptr);
     ASSERT(sink);
     webKitGLVideoSinkSetMediaPlayerPrivate(WEBKIT_GL_VIDEO_SINK(sink), this);
+
+    gboolean handlesRotationTags;
+    g_object_get(sink, "handles-rotation-tags", &handlesRotationTags, nullptr);
+    m_shouldHandleOrientationTags = !handlesRotationTags;
+
     return sink;
 }
 #endif // USE(GSTREAMER_GL)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to