Title: [277088] trunk/Source/WebCore
Revision
277088
Author
commit-qu...@webkit.org
Date
2021-05-06 08:04:18 -0700 (Thu, 06 May 2021)

Log Message

[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 <pnorm...@igalia.com> 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: trunk/Source/WebCore/ChangeLog (277087 => 277088)


--- trunk/Source/WebCore/ChangeLog	2021-05-06 14:52:13 UTC (rev 277087)
+++ trunk/Source/WebCore/ChangeLog	2021-05-06 15:04:18 UTC (rev 277088)
@@ -1,3 +1,23 @@
+2021-05-06  Philippe Normand  <pnorm...@igalia.com>
+
+        [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-06  Chris Dumez  <cdu...@apple.com>
 
         imported/w3c/web-platform-tests/eventsource/format-utf-8.htm is failing on some platforms

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp (277087 => 277088)


--- trunk/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp	2021-05-06 14:52:13 UTC (rev 277087)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp	2021-05-06 15:04:18 UTC (rev 277088)
@@ -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)
@@ -210,6 +222,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();
@@ -232,6 +247,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: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (277087 => 277088)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-05-06 14:52:13 UTC (rev 277087)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-05-06 15:04:18 UTC (rev 277088)
@@ -3364,6 +3364,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
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to