Title: [275412] trunk
Revision
275412
Author
ph...@webkit.org
Date
2021-04-02 01:55:22 -0700 (Fri, 02 Apr 2021)

Log Message

REGRESSION(r268176): [GStreamer] media/video-orientation-canvas.html fails
https://bugs.webkit.org/show_bug.cgi?id=223850

Reviewed by Carlos Alberto Lopez Perez.

Source/WebCore:

The GL pipeline used by the player is now able to handle image rotation tags itself. Manual
handling of the image rotation tags is now performed only when the pipeline is not able to
do it by itself.

* platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
(webKitGLVideoSinkConstructed):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
(WebCore::getVideoOrientation):
(WebCore::MediaPlayerPrivateGStreamer::updateVideoSizeAndOrientationFromCaps):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:

LayoutTests:

* platform/gtk/TestExpectations: Unflag now-passing test.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (275411 => 275412)


--- trunk/LayoutTests/ChangeLog	2021-04-02 08:50:20 UTC (rev 275411)
+++ trunk/LayoutTests/ChangeLog	2021-04-02 08:55:22 UTC (rev 275412)
@@ -1,3 +1,12 @@
+2021-04-02  Philippe Normand  <pnorm...@igalia.com>
+
+        REGRESSION(r268176): [GStreamer] media/video-orientation-canvas.html fails
+        https://bugs.webkit.org/show_bug.cgi?id=223850
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        * platform/gtk/TestExpectations: Unflag now-passing test.
+
 2021-04-02  Youenn Fablet  <you...@apple.com>
 
         Bail out early if encoded frame is written twice

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (275411 => 275412)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2021-04-02 08:50:20 UTC (rev 275411)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2021-04-02 08:55:22 UTC (rev 275412)
@@ -2465,8 +2465,6 @@
 webkit.org/b/224062 webgl/1.0.3/conformance/glsl/misc/shaders-with-varyings.html [ Failure ]
 webkit.org/b/224062 webgl/1.0.3/conformance/rendering/gl-scissor-test.html [ Failure ]
 
-webkit.org/b/224064 media/video-orientation-canvas.html [ Failure ]
-
 webkit.org/b/222495 media/media-source/media-source-webm-vorbis-partial.html [ Failure ]
 
 webkit.org/b/224067 media/media-source/media-source-timestampoffset-trim.html [ Failure ]

Modified: trunk/Source/WebCore/ChangeLog (275411 => 275412)


--- trunk/Source/WebCore/ChangeLog	2021-04-02 08:50:20 UTC (rev 275411)
+++ trunk/Source/WebCore/ChangeLog	2021-04-02 08:55:22 UTC (rev 275412)
@@ -1,3 +1,22 @@
+2021-04-02  Philippe Normand  <pnorm...@igalia.com>
+
+        REGRESSION(r268176): [GStreamer] media/video-orientation-canvas.html fails
+        https://bugs.webkit.org/show_bug.cgi?id=223850
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        The GL pipeline used by the player is now able to handle image rotation tags itself. Manual
+        handling of the image rotation tags is now performed only when the pipeline is not able to
+        do it by itself.
+
+        * platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
+        (webKitGLVideoSinkConstructed):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
+        (WebCore::getVideoOrientation):
+        (WebCore::MediaPlayerPrivateGStreamer::updateVideoSizeAndOrientationFromCaps):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+
 2021-04-01  Yusuke Suzuki  <ysuz...@apple.com>
 
         [WTF] Introduce RobinHoodHashTable

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


--- trunk/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp	2021-04-02 08:50:20 UTC (rev 275411)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp	2021-04-02 08:55:22 UTC (rev 275412)
@@ -81,9 +81,13 @@
 
     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");
+
     ASSERT(upload);
     ASSERT(colorconvert);
-    gst_bin_add_many(GST_BIN_CAST(sink), upload, colorconvert, sink->priv->appSink.get(), nullptr);
+    ASSERT(videoFlip);
+    gst_bin_add_many(GST_BIN_CAST(sink), upload, colorconvert, videoFlip, 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
@@ -109,7 +113,7 @@
 
     if (imxVideoConvertG2D)
         gst_element_link(imxVideoConvertG2D, upload);
-    gst_element_link_many(upload, colorconvert, sink->priv->appSink.get(), nullptr);
+    gst_element_link_many(upload, colorconvert, videoFlip, sink->priv->appSink.get(), nullptr);
 
     GstElement* sinkElement =
         [&] {

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (275411 => 275412)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-04-02 08:50:20 UTC (rev 275411)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-04-02 08:55:22 UTC (rev 275412)
@@ -2769,10 +2769,10 @@
         // the image-orientation tag.
         GstElement* videoFlip = gst_element_factory_make("videoflip", nullptr);
         if (videoFlip) {
-            g_object_set(videoFlip, "method", 8, nullptr);
+            gst_util_set_object_arg(G_OBJECT(videoFlip), "method", "automatic");
             g_object_set(m_pipeline.get(), "video-filter", videoFlip, nullptr);
         } else
-            GST_WARNING("The videoflip element is missing, video rotation support is now disabled. Please check your gst-plugins-good installation.");
+            m_shouldHandleOrientationTags = true;
     }
 
     GRefPtr<GstPad> videoSinkPad = adoptGRef(gst_element_get_static_pad(m_videoSink.get(), "sink"));
@@ -2946,7 +2946,7 @@
     GRefPtr<GstEvent> tagsEvent = adoptGRef(gst_pad_get_sticky_event(pad.get(), GST_EVENT_TAG, 0));
     if (!tagsEvent) {
         GST_DEBUG_OBJECT(pad.get(), "No sticky tag event, applying no rotation.");
-        return ImageOrientation::OriginTopLeft;
+        return ImageOrientation::None;
     }
 
     GstTagList* tagList;
@@ -2955,18 +2955,27 @@
     GUniqueOutPtr<gchar> tag;
     if (!gst_tag_list_get_string(tagList, GST_TAG_IMAGE_ORIENTATION, &tag.outPtr())) {
         GST_DEBUG_OBJECT(pad.get(), "No image_orientation tag, applying no rotation.");
-        return ImageOrientation::OriginTopLeft;
+        return ImageOrientation::None;
     }
 
     GST_DEBUG_OBJECT(pad.get(), "Found image_orientation tag: %s", tag.get());
+    if (!g_strcmp0(tag.get(), "flip-rotate-0"))
+        return ImageOrientation::OriginTopRight;
+    if (!g_strcmp0(tag.get(), "rotate-180"))
+        return ImageOrientation::OriginBottomRight;
+    if (!g_strcmp0(tag.get(), "flip-rotate-180"))
+        return ImageOrientation::OriginBottomLeft;
+    if (!g_strcmp0(tag.get(), "flip-rotate-270"))
+        return ImageOrientation::OriginLeftTop;
     if (!g_strcmp0(tag.get(), "rotate-90"))
         return ImageOrientation::OriginRightTop;
-    if (!g_strcmp0(tag.get(), "rotate-180"))
-        return ImageOrientation::OriginBottomRight;
+    if (!g_strcmp0(tag.get(), "flip-rotate-90"))
+        return ImageOrientation::OriginRightBottom;
     if (!g_strcmp0(tag.get(), "rotate-270"))
         return ImageOrientation::OriginLeftBottom;
+
     // Default rotation.
-    return ImageOrientation::OriginTopLeft;
+    return ImageOrientation::None;
 }
 
 void MediaPlayerPrivateGStreamer::updateVideoSizeAndOrientationFromCaps(const GstCaps* caps)
@@ -2986,7 +2995,8 @@
         return;
     }
 
-    setVideoSourceOrientation(getVideoOrientation(m_videoSink.get()));
+    if (m_shouldHandleOrientationTags)
+        setVideoSourceOrientation(getVideoOrientation(m_videoSink.get()));
 
 #if USE(TEXTURE_MAPPER_GL)
     // When using accelerated compositing, if the video is tagged as rotated 90 or 270 degrees, swap width and height.

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (275411 => 275412)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2021-04-02 08:50:20 UTC (rev 275411)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2021-04-02 08:55:22 UTC (rev 275412)
@@ -530,6 +530,9 @@
     uint64_t m_totalVideoFrames { 0 };
     uint64_t m_droppedVideoFrames { 0 };
 
+    // This is set to true if no videoflip element has been added to the pipeline.
+    bool m_shouldHandleOrientationTags { false };
+
 private:
 #if USE(WPE_VIDEO_PLANE_DISPLAY_DMABUF)
     GUniquePtr<struct wpe_video_plane_display_dmabuf_source> m_wpeVideoPlaneDisplayDmaBuf;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to