Title: [203059] trunk/Source/WebCore
Revision
203059
Author
[email protected]
Date
2016-07-11 07:44:35 -0700 (Mon, 11 Jul 2016)

Log Message

Red and blue colors are swapped in video rendered through WebGL when GSTREAMER_GL is enabled
https://bugs.webkit.org/show_bug.cgi?id=159621

Patch by Olivier Blin <[email protected]> on 2016-07-11
Reviewed by Philippe Normand.

When a video is rendered through WebGL, and GSTREAMER_GL is enabled, red and blue colors are swapped.
This occurs for example with the following videos:
http://www.scirra.com/labs/bugs/webglvideo/
http://www.dailymotion.com/embed/video/x4jiicp?autoplay=1

This is because ImageGStreamerCairo expects video frames in either
BGRA or ARGB, while when GSTREAMER_GL is enabled,
createVideoSinkGL() forces a RGBA format.

Without GSTREAMER_GL, the rendering is fine since
VideoSinkGStreamer uses either BGRA or ARGB.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (203058 => 203059)


--- trunk/Source/WebCore/ChangeLog	2016-07-11 14:41:42 UTC (rev 203058)
+++ trunk/Source/WebCore/ChangeLog	2016-07-11 14:44:35 UTC (rev 203059)
@@ -1,3 +1,25 @@
+2016-07-11  Olivier Blin  <[email protected]>
+
+        Red and blue colors are swapped in video rendered through WebGL when GSTREAMER_GL is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=159621
+
+        Reviewed by Philippe Normand.
+
+        When a video is rendered through WebGL, and GSTREAMER_GL is enabled, red and blue colors are swapped.
+        This occurs for example with the following videos:
+        http://www.scirra.com/labs/bugs/webglvideo/
+        http://www.dailymotion.com/embed/video/x4jiicp?autoplay=1
+
+        This is because ImageGStreamerCairo expects video frames in either
+        BGRA or ARGB, while when GSTREAMER_GL is enabled,
+        createVideoSinkGL() forces a RGBA format.
+
+        Without GSTREAMER_GL, the rendering is fine since
+        VideoSinkGStreamer uses either BGRA or ARGB.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL):
+
 2016-07-11  Philippe Normand  <[email protected]>
 
         [GStreamer] remove WEBKIT_DEBUG support

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (203058 => 203059)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2016-07-11 14:41:42 UTC (rev 203058)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2016-07-11 14:44:35 UTC (rev 203059)
@@ -85,6 +85,12 @@
 #include <cairo-gl.h>
 #endif
 
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define GST_GL_CAPS_FORMAT "BGRA"
+#else
+#define GST_GL_CAPS_FORMAT "ARGB"
+#endif
+
 GST_DEBUG_CATEGORY(webkit_media_player_debug);
 #define GST_CAT_DEFAULT webkit_media_player_debug
 
@@ -836,7 +842,7 @@
 
     gst_bin_add_many(GST_BIN(videoSink), upload, colorconvert, appsink, nullptr);
 
-    GRefPtr<GstCaps> caps = adoptGRef(gst_caps_from_string("video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), format = (string) { RGBA }"));
+    GRefPtr<GstCaps> caps = adoptGRef(gst_caps_from_string("video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), format = (string) { " GST_GL_CAPS_FORMAT " }"));
 
     result &= gst_element_link_pads(upload, "src", colorconvert, "sink");
     result &= gst_element_link_pads_filtered(colorconvert, "src", appsink, "sink", caps.get());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to