glmixer: do not leak pool in error cases

https://bugzilla.gnome.org/show_bug.cgi?id=736729
This commit is contained in:
Ognyan Tonchev 2014-09-16 11:41:16 +02:00 committed by Sebastian Dröge
parent 5294a68122
commit 31703f9ac3

View file

@ -600,22 +600,6 @@ gst_gl_mixer_decide_allocation (GstGLMixer * mix, GstQuery * query)
GstGLContext *other_context = NULL; GstGLContext *other_context = NULL;
GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (mix); 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)) if (!gst_gl_ensure_display (mix, &mix->display))
return FALSE; 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_gl_context_gen_texture (mix->context, &mix->out_tex_id,
GST_VIDEO_FORMAT_RGBA, out_width, out_height); GST_VIDEO_FORMAT_RGBA, out_width, out_height);
gst_query_parse_allocation (query, &caps, NULL);
if (mixer_class->set_caps) if (mixer_class->set_caps)
mixer_class->set_caps (mix, 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_cond_signal (&mix->priv->gl_resource_cond);
g_mutex_unlock (&mix->priv->gl_resource_lock); 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) if (!pool)
pool = gst_gl_buffer_pool_new (mix->context); pool = gst_gl_buffer_pool_new (mix->context);