summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-01-01 12:12:35 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-01-04 15:01:19 -0500
commit536a67ec9631dbea1aa8073cb5ecb2af513a647f (patch)
treee6af7040e57cdd75a5b01569e70b6770b0de651e /modules
parent53fe7513717b983143331b89db2e029300bb08f8 (diff)
downloadgtk+-536a67ec9631dbea1aa8073cb5ecb2af513a647f.tar.gz
media: Only force GL if we're using a GL renderer
When we are not using a GL renderer, getting GL textures is no advantage to us, so don't make gstreamer send its frames as GL memory in this case.
Diffstat (limited to 'modules')
-rw-r--r--modules/media/gtkgstpaintable.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/modules/media/gtkgstpaintable.c b/modules/media/gtkgstpaintable.c
index fcc5a4f1d2..470a5f59e4 100644
--- a/modules/media/gtkgstpaintable.c
+++ b/modules/media/gtkgstpaintable.c
@@ -20,10 +20,11 @@
#include "config.h"
#include "gtkgstpaintableprivate.h"
-
#include "gtkgstsinkprivate.h"
+#include <gtk/gtk.h>
#include <gst/player/gstplayer-video-renderer.h>
+#include <gsk/gl/gskglrenderer.h>
#include <math.h>
@@ -122,6 +123,9 @@ gtk_gst_paintable_video_renderer_create_video_sink (GstPlayerVideoRenderer *rend
"gl-context", self->context,
NULL);
+ if (self->context == NULL)
+ return sink;
+
glsinkbin = gst_element_factory_make ("glsinkbin", NULL);
g_object_set (glsinkbin, "sink", sink, NULL);
@@ -175,10 +179,20 @@ gtk_gst_paintable_realize (GtkGstPaintable *self,
GdkSurface *surface)
{
GError *error = NULL;
+ GtkNative *native;
+ GskRenderer *renderer;
if (self->context)
return;
+ native = gtk_native_get_for_surface (surface);
+ renderer = gtk_native_get_renderer (native);
+ if (!GSK_IS_GL_RENDERER (renderer))
+ {
+ GST_INFO ("not using GL with a %s renderer\n", G_OBJECT_TYPE_NAME (renderer));
+ return;
+ }
+
self->context = gdk_surface_create_gl_context (surface, &error);
if (self->context == NULL)
{