From 276b682559cee04b3ca361d79ad8b89a294c385e Mon Sep 17 00:00:00 2001 From: Ognyan Tonchev Date: Tue, 16 Sep 2014 11:41:16 +0200 Subject: [PATCH] glmixer: do not leak pool in error cases https://bugzilla.gnome.org/show_bug.cgi?id=736729 --- ext/gl/gstglmixer.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/ext/gl/gstglmixer.c b/ext/gl/gstglmixer.c index 62bb4d455d..5aa1beab90 100644 --- a/ext/gl/gstglmixer.c +++ b/ext/gl/gstglmixer.c @@ -600,22 +600,6 @@ gst_gl_mixer_decide_allocation (GstGLMixer * mix, GstQuery * query) GstGLContext *other_context = NULL; GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (mix); - gst_query_parse_allocation (query, &caps, NULL); - - if (gst_query_get_n_allocation_pools (query) > 0) { - gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max); - - update_pool = TRUE; - } else { - GstVideoInfo vinfo; - - gst_video_info_init (&vinfo); - gst_video_info_from_caps (&vinfo, caps); - size = vinfo.size; - min = max = 0; - update_pool = FALSE; - } - if (!gst_gl_ensure_display (mix, &mix->display)) return FALSE; @@ -686,6 +670,8 @@ gst_gl_mixer_decide_allocation (GstGLMixer * mix, GstQuery * query) gst_gl_context_gen_texture (mix->context, &mix->out_tex_id, GST_VIDEO_FORMAT_RGBA, out_width, out_height); + gst_query_parse_allocation (query, &caps, NULL); + if (mixer_class->set_caps) mixer_class->set_caps (mix, caps); @@ -693,6 +679,20 @@ gst_gl_mixer_decide_allocation (GstGLMixer * mix, GstQuery * query) g_cond_signal (&mix->priv->gl_resource_cond); g_mutex_unlock (&mix->priv->gl_resource_lock); + if (gst_query_get_n_allocation_pools (query) > 0) { + gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max); + + update_pool = TRUE; + } else { + GstVideoInfo vinfo; + + gst_video_info_init (&vinfo); + gst_video_info_from_caps (&vinfo, caps); + size = vinfo.size; + min = max = 0; + update_pool = FALSE; + } + if (!pool) pool = gst_gl_buffer_pool_new (mix->context);