From 59c388abca7f3a00bf2799e56757bb10df985ecc Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Mon, 12 May 2014 21:51:38 +1000 Subject: [PATCH] gl/upload: avoid performing color conversion when there is no need One such example is when the buffer contains GstGLMemory in the RGBA format https://bugzilla.gnome.org/show_bug.cgi?id=729278 --- gst-libs/gst/gl/gstglupload.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c index adbb723d1f..1a17f3d1fb 100644 --- a/gst-libs/gst/gl/gstglupload.c +++ b/gst-libs/gst/gl/gstglupload.c @@ -273,6 +273,16 @@ gst_gl_upload_perform_with_buffer (GstGLUpload * upload, GstBuffer * buffer, mem = gst_buffer_peek_memory (buffer, 0); if (gst_is_gl_memory (mem)) { + if (GST_VIDEO_INFO_FORMAT (&upload->in_info) == GST_VIDEO_FORMAT_RGBA) { + GstMapInfo map_info; + + gst_memory_map (mem, &map_info, GST_MAP_READ | GST_MAP_GL); + gst_memory_unmap (mem, &map_info); + + *tex_id = ((GstGLMemory *) mem)->tex_id; + return TRUE; + } + if (!upload->out_tex) upload->out_tex = (GstGLMemory *) gst_gl_memory_alloc (upload->context, GST_VIDEO_GL_TEXTURE_TYPE_RGBA, GST_VIDEO_INFO_WIDTH (&upload->in_info),