From 71548893bf4b17992e36aa89d25e7cc3776cbba7 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Wed, 2 Apr 2014 22:42:50 +1100 Subject: [PATCH] gl: avoid adding a NULL pool to propose allocation --- ext/gl/gstglimagesink.c | 6 ++++-- gst-libs/gst/gl/gstglfilter.c | 6 ++++-- gst-libs/gst/gl/gstglmixer.c | 11 +++++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c index 6db9cfaf2e..04c2502486 100644 --- a/ext/gl/gstglimagesink.c +++ b/ext/gl/gstglimagesink.c @@ -921,12 +921,14 @@ gst_glimage_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) goto config_failed; } /* we need at least 2 buffer because we hold on to the last one */ - gst_query_add_allocation_pool (query, pool, size, 2, 0); + if (pool) { + gst_query_add_allocation_pool (query, pool, size, 2, 0); + gst_object_unref (pool); + } /* we also support various metadata */ gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, 0); - gst_object_unref (pool); gl_apis = gst_gl_api_to_string (gst_gl_context_get_gl_api (glimage_sink->context)); diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c index 1358e006a1..41339f17fe 100644 --- a/gst-libs/gst/gl/gstglfilter.c +++ b/gst-libs/gst/gl/gstglfilter.c @@ -806,8 +806,10 @@ gst_gl_filter_propose_allocation (GstBaseTransform * trans, goto config_failed; } /* we need at least 2 buffer because we hold on to the last one */ - gst_query_add_allocation_pool (query, pool, size, 1, 0); - gst_object_unref (pool); + if (pool) { + gst_query_add_allocation_pool (query, pool, size, 1, 0); + gst_object_unref (pool); + } /* we also support various metadata */ gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, 0); diff --git a/gst-libs/gst/gl/gstglmixer.c b/gst-libs/gst/gl/gstglmixer.c index e4714b7ab4..41db067328 100644 --- a/gst-libs/gst/gl/gstglmixer.c +++ b/gst-libs/gst/gl/gstglmixer.c @@ -321,7 +321,7 @@ gst_gl_mixer_propose_allocation (GstGLMixer * mix, GstBufferPool *pool; GstStructure *config; GstCaps *caps; - guint size; + guint size = 0; gboolean need_pool; GError *error = NULL; GstStructure *gl_context; @@ -381,8 +381,11 @@ gst_gl_mixer_propose_allocation (GstGLMixer * mix, if (!gst_buffer_pool_set_config (pool, config)) goto config_failed; } - gst_query_add_allocation_pool (query, pool, size, 1, 0); - gst_object_unref (pool); + + if (pool) { + gst_query_add_allocation_pool (query, pool, size, 1, 0); + gst_object_unref (pool); + } /* we also support various metadata */ gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, 0); @@ -1614,7 +1617,7 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf) guint out_tex; guint array_index = 0; guint i; - gboolean res; + gboolean res = TRUE; GST_TRACE ("Processing buffers");