From 65b68724131d4ce15719af81cd306493f3decb27 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Mon, 16 Sep 2013 19:07:18 +1000 Subject: [PATCH] [813/906] unref the pool on shutdown --- gst-libs/gst/gl/gstglmixer.c | 12 ++++++++++++ gst/gl/gstglimagesink.c | 21 ++++++++++++++++----- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/gst-libs/gst/gl/gstglmixer.c b/gst-libs/gst/gl/gstglmixer.c index 7b6f7d30d3..3a73a62cf0 100644 --- a/gst-libs/gst/gl/gstglmixer.c +++ b/gst-libs/gst/gl/gstglmixer.c @@ -1010,6 +1010,8 @@ gst_gl_mixer_set_allocation (GstGLMixer * mix, GstQuery *oldquery; GstGLMixerPrivate *priv = mix->priv; + GST_DEBUG ("storing allocation query"); + GST_OBJECT_LOCK (mix); oldpool = priv->pool; priv->pool = pool; @@ -2171,6 +2173,16 @@ gst_gl_mixer_change_state (GstElement * element, GstStateChange transition) walk = walk->next; } + if (mix->priv->query) { + gst_query_unref (mix->priv->query); + mix->priv->query = NULL; + } + + if (mix->priv->pool) { + gst_object_unref (mix->priv->pool); + mix->priv->pool = NULL; + } + if (mix->display) { gst_object_unref (mix->display); mix->display = NULL; diff --git a/gst/gl/gstglimagesink.c b/gst/gl/gstglimagesink.c index 04ad4cf510..6036c5ab5f 100644 --- a/gst/gl/gstglimagesink.c +++ b/gst/gl/gstglimagesink.c @@ -118,6 +118,8 @@ static void gst_glimage_sink_set_property (GObject * object, guint prop_id, static void gst_glimage_sink_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * param_spec); +static gboolean gst_glimage_sink_stop (GstBaseSink * bsink); + static gboolean gst_glimage_sink_query (GstBaseSink * bsink, GstQuery * query); static GstStateChangeReturn @@ -250,6 +252,7 @@ gst_glimage_sink_class_init (GstGLImageSinkClass * klass) gstbasesink_class->preroll = gst_glimage_sink_render; gstbasesink_class->render = gst_glimage_sink_render; gstbasesink_class->propose_allocation = gst_glimage_sink_propose_allocation; + gstbasesink_class->stop = gst_glimage_sink_stop; } static void @@ -330,11 +333,6 @@ gst_glimage_sink_finalize (GObject * object) glimage_sink = GST_GLIMAGE_SINK (object); - if (glimage_sink->pool) { - gst_object_unref (glimage_sink->pool); - glimage_sink->pool = NULL; - } - g_mutex_clear (&glimage_sink->drawing_lock); g_free (glimage_sink->display_name); @@ -409,6 +407,19 @@ gst_glimage_sink_cleanup_glthread (GstGLImageSink * gl_sink) * GstElement methods */ +static gboolean +gst_glimage_sink_stop (GstBaseSink * bsink) +{ + GstGLImageSink *glimage_sink = GST_GLIMAGE_SINK (bsink); + + if (glimage_sink->pool) { + gst_object_unref (glimage_sink->pool); + glimage_sink->pool = NULL; + } + + return TRUE; +} + static GstStateChangeReturn gst_glimage_sink_change_state (GstElement * element, GstStateChange transition) {