mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-08 17:50:10 +00:00
Restructure gtk_gst_paintable_video_renderer_create_video_sink
This code had too many early exits and was leaking GL contexts and Gstreamer elements. Simplify.
This commit is contained in:
parent
b06ac9826c
commit
9fc7d8e947
@ -134,7 +134,7 @@ gtk_gst_paintable_video_renderer_create_video_sink (GstPlayerVideoRenderer *rend
|
||||
{
|
||||
GtkGstPaintable *self = GTK_GST_PAINTABLE (renderer);
|
||||
GstElement *sink;
|
||||
GdkGLContext *ctx;
|
||||
GdkGLContext *ctx = NULL;
|
||||
GdkDisplay *display;
|
||||
|
||||
if (self->surface)
|
||||
@ -148,20 +148,21 @@ gtk_gst_paintable_video_renderer_create_video_sink (GstPlayerVideoRenderer *rend
|
||||
"display", display,
|
||||
NULL);
|
||||
|
||||
if (self->context != NULL)
|
||||
g_object_get (GTK_GST_SINK (sink), "gl-context", &ctx, NULL);
|
||||
g_object_get (GTK_GST_SINK (sink), "gl-context", &ctx, NULL);
|
||||
|
||||
if (self->context != NULL && ctx != NULL)
|
||||
if (ctx != NULL)
|
||||
{
|
||||
GstElement *glsinkbin = gst_element_factory_make ("glsinkbin", NULL);
|
||||
GstElement *glsinkbin;
|
||||
|
||||
if (!glsinkbin)
|
||||
return NULL;
|
||||
glsinkbin = gst_element_factory_make ("glsinkbin", NULL);
|
||||
|
||||
if (glsinkbin)
|
||||
g_object_set (glsinkbin, "sink", sink, NULL);
|
||||
|
||||
g_object_unref (sink);
|
||||
sink = glsinkbin;
|
||||
|
||||
g_object_set (glsinkbin, "sink", sink, NULL);
|
||||
g_object_unref (ctx);
|
||||
|
||||
return glsinkbin;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -175,9 +176,9 @@ gtk_gst_paintable_video_renderer_create_video_sink (GstPlayerVideoRenderer *rend
|
||||
"display", display,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return sink;
|
||||
}
|
||||
|
||||
return sink;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user