RESOLVED FIXED 173050
[GTK][WPE][GSTREAMER_GL] Change the colorspace used by the video frames provided by GStreamer
https://bugs.webkit.org/show_bug.cgi?id=173050
Summary [GTK][WPE][GSTREAMER_GL] Change the colorspace used by the video frames provi...
Miguel Gomez
Reported 2017-06-07 02:53:46 PDT
Currently, when using gstreamer-gl, the colorspace used by gstreamer to provide the video frames in RGBA. While this is convenient to paint the frames to the TextureMapper (which uses RGBA as well), it's a problem when the video frames need to be rendered with the CPU, for example when rendering to a non accelerated canvas or to webgl through glTexSubImage2D (yes, this is not accelerated!!). The problem comes because when the video frames are downloaded to the CPU, RGBA gets turned into ABGR (with the endianness change), and cairo expects ARGB, which means that the R and B components are swapped. We could fix this by manually swapping the R and B components, but it's a waste of resources. What we need to do instead is changing the format used by gstreamer to BGRA, so when downloaded to the CPU it will automatically be the ARGB expected by cairo, and perform a colorspace conversion from BGRA to RGBA on with the shader when drawing the frames to the TextureMapper, so we don't waste CPU on byte swapping.
Attachments
Patch (11.58 KB, patch)
2017-06-07 03:13 PDT, Miguel Gomez
no flags
Patch (11.60 KB, patch)
2017-06-08 01:48 PDT, Miguel Gomez
no flags
Patch (11.60 KB, patch)
2017-06-08 01:49 PDT, Miguel Gomez
no flags
Miguel Gomez
Comment 1 2017-06-07 03:13:09 PDT
Zan Dobersek
Comment 2 2017-06-07 07:13:35 PDT
Comment on attachment 312176 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=312176&action=review > Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:53 > +#define TEXTUREMAPPER_COLORCONVERT_FLAG TextureMapperGL::ShouldConvertTextureBGRAToRGBA > +#define TEXTURECOPIER_COLORCONVERT_FLAG VideoTextureCopierGStreamer::ColorConversion::ConvertBGRAToRGBA These are hard to process IMO. TEXTURE_MAPPER_COLOR_CONVERT_FLAG and TEXTURE_COPIER_COLOR_CONVERT_FLAG are fine.
Miguel Gomez
Comment 3 2017-06-08 01:48:25 PDT
Miguel Gomez
Comment 4 2017-06-08 01:49:17 PDT
WebKit Commit Bot
Comment 5 2017-06-08 03:16:43 PDT
Comment on attachment 312288 [details] Patch Clearing flags on attachment: 312288 Committed r217927: <http://trac.webkit.org/changeset/217927>
WebKit Commit Bot
Comment 6 2017-06-08 03:16:45 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.