mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 14:00:09 +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
0128aa9ead
commit
3cbb4aeb19
@ -134,7 +134,7 @@ gtk_gst_paintable_video_renderer_create_video_sink (GstPlayerVideoRenderer *rend
|
|||||||
{
|
{
|
||||||
GtkGstPaintable *self = GTK_GST_PAINTABLE (renderer);
|
GtkGstPaintable *self = GTK_GST_PAINTABLE (renderer);
|
||||||
GstElement *sink;
|
GstElement *sink;
|
||||||
GdkGLContext *ctx;
|
GdkGLContext *ctx = NULL;
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
|
|
||||||
if (self->surface)
|
if (self->surface)
|
||||||
@ -148,20 +148,21 @@ gtk_gst_paintable_video_renderer_create_video_sink (GstPlayerVideoRenderer *rend
|
|||||||
"display", display,
|
"display", display,
|
||||||
NULL);
|
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)
|
glsinkbin = gst_element_factory_make ("glsinkbin", NULL);
|
||||||
return 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);
|
g_object_unref (ctx);
|
||||||
|
|
||||||
return glsinkbin;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -175,9 +176,9 @@ gtk_gst_paintable_video_renderer_create_video_sink (GstPlayerVideoRenderer *rend
|
|||||||
"display", display,
|
"display", display,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sink;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return sink;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user