From: Matthew Waters Date: Mon, 27 Apr 2015 05:20:56 +0000 (+1000) Subject: gl: unref display/other-context in the correct place X-Git-Tag: 1.16.2~955^2~916 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f4f328416172f62f5ee99af2c92c98ae203e8eba;p=platform%2Fupstream%2Fgst-plugins-base.git gl: unref display/other-context in the correct place Otherwise state changes from PLAYING->READY->PAUSED will cause there to to be no display configured on the element. https://bugzilla.gnome.org/show_bug.cgi?id=748405 --- diff --git a/ext/gl/gstglbasemixer.c b/ext/gl/gstglbasemixer.c index 448c6a6..0e670e0 100644 --- a/ext/gl/gstglbasemixer.c +++ b/ext/gl/gstglbasemixer.c @@ -247,8 +247,6 @@ static gboolean gst_gl_base_mixer_set_allocation (GstGLBaseMixer * mix, GstBufferPool * pool, GstAllocator * allocator, GstAllocationParams * params, GstQuery * query); -static void gst_gl_base_mixer_finalize (GObject * object); - static void gst_gl_base_mixer_class_init (GstGLBaseMixerClass * klass) { @@ -266,8 +264,6 @@ gst_gl_base_mixer_class_init (GstGLBaseMixerClass * klass) g_type_class_add_private (klass, sizeof (GstGLBaseMixerPrivate)); - gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_gl_base_mixer_finalize); - gobject_class->get_property = gst_gl_base_mixer_get_property; gobject_class->set_property = gst_gl_base_mixer_set_property; @@ -314,19 +310,6 @@ gst_gl_base_mixer_init (GstGLBaseMixer * mix) } static void -gst_gl_base_mixer_finalize (GObject * object) -{ - GstGLBaseMixer *mix = GST_GL_BASE_MIXER (object); - - if (mix->priv->other_context) { - gst_object_unref (mix->priv->other_context); - mix->priv->other_context = NULL; - } - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void gst_gl_base_mixer_set_context (GstElement * element, GstContext * context) { GstGLBaseMixer *mix = GST_GL_BASE_MIXER (element); @@ -674,11 +657,6 @@ gst_gl_base_mixer_stop (GstAggregator * agg) mix->priv->pool = NULL; } - if (mix->display) { - gst_object_unref (mix->display); - mix->display = NULL; - } - if (mix->context) { gst_object_unref (mix->context); mix->context = NULL; @@ -717,6 +695,17 @@ gst_gl_base_mixer_change_state (GstElement * element, GstStateChange transition) return ret; switch (transition) { + case GST_STATE_CHANGE_READY_TO_NULL: + if (mix->priv->other_context) { + gst_object_unref (mix->priv->other_context); + mix->priv->other_context = NULL; + } + + if (mix->display) { + gst_object_unref (mix->display); + mix->display = NULL; + } + break; default: break; } diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c index 796392d..d23cc83 100644 --- a/ext/gl/gstglimagesink.c +++ b/ext/gl/gstglimagesink.c @@ -624,11 +624,6 @@ gst_glimage_sink_finalize (GObject * object) g_mutex_clear (&glimage_sink->drawing_lock); - if (glimage_sink->other_context) { - gst_object_unref (glimage_sink->other_context); - glimage_sink->other_context = NULL; - } - g_free (glimage_sink->display_name); GST_DEBUG ("finalized"); @@ -971,6 +966,11 @@ gst_glimage_sink_change_state (GstElement * element, GstStateChange transition) break; } case GST_STATE_CHANGE_READY_TO_NULL: + if (glimage_sink->other_context) { + gst_object_unref (glimage_sink->other_context); + glimage_sink->other_context = NULL; + } + if (glimage_sink->display) { gst_object_unref (glimage_sink->display); glimage_sink->display = NULL; diff --git a/ext/gl/gstgltestsrc.c b/ext/gl/gstgltestsrc.c index 788fd86..100ecaa 100644 --- a/ext/gl/gstgltestsrc.c +++ b/ext/gl/gstgltestsrc.c @@ -80,7 +80,6 @@ static void gst_gl_test_src_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_gl_test_src_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static void gst_gl_test_src_dispose (GObject * object); static gboolean gst_gl_test_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps); static GstCaps *gst_gl_test_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter); @@ -156,7 +155,6 @@ gst_gl_test_src_class_init (GstGLTestSrcClass * klass) gobject_class->set_property = gst_gl_test_src_set_property; gobject_class->get_property = gst_gl_test_src_get_property; - gobject_class->dispose = gst_gl_test_src_dispose; g_object_class_install_property (gobject_class, PROP_PATTERN, g_param_spec_enum ("pattern", "Pattern", @@ -387,18 +385,6 @@ gst_gl_test_src_set_pattern (GstGLTestSrc * gltestsrc, gint pattern_type) } static void -gst_gl_test_src_dispose (GObject * object) -{ - GstGLTestSrc *src = GST_GL_TEST_SRC (object); - - if (src->other_context) - gst_object_unref (src->other_context); - src->other_context = NULL; - - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void gst_gl_test_src_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { @@ -749,11 +735,6 @@ gst_gl_test_src_stop (GstBaseSrc * basesrc) src->context = NULL; } - if (src->display) { - gst_object_unref (src->display); - src->display = NULL; - } - return TRUE; } @@ -934,6 +915,17 @@ gst_gl_test_src_change_state (GstElement * element, GstStateChange transition) return ret; switch (transition) { + case GST_STATE_CHANGE_READY_TO_NULL: + if (src->other_context) { + gst_object_unref (src->other_context); + src->other_context = NULL; + } + + if (src->display) { + gst_object_unref (src->display); + src->display = NULL; + } + break; default: break; } diff --git a/gst-libs/gst/gl/gstglbasefilter.c b/gst-libs/gst/gl/gstglbasefilter.c index 5bff1ea..0b49e09 100644 --- a/gst-libs/gst/gl/gstglbasefilter.c +++ b/gst-libs/gst/gl/gstglbasefilter.c @@ -56,7 +56,6 @@ static void gst_gl_base_filter_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_gl_base_filter_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static void gst_gl_base_filter_finalize (GObject * object); static void gst_gl_base_filter_set_context (GstElement * element, GstContext * context); @@ -89,7 +88,6 @@ gst_gl_base_filter_class_init (GstGLBaseFilterClass * klass) gobject_class->set_property = gst_gl_base_filter_set_property; gobject_class->get_property = gst_gl_base_filter_get_property; - gobject_class->finalize = gst_gl_base_filter_finalize; GST_BASE_TRANSFORM_CLASS (klass)->query = gst_gl_base_filter_query; GST_BASE_TRANSFORM_CLASS (klass)->start = gst_gl_base_filter_start; @@ -118,19 +116,6 @@ gst_gl_base_filter_init (GstGLBaseFilter * filter) } static void -gst_gl_base_filter_finalize (GObject * object) -{ - GstGLBaseFilter *filter = GST_GL_BASE_FILTER (object); - - if (filter->priv->other_context) { - gst_object_unref (filter->priv->other_context); - filter->priv->other_context = NULL; - } - - G_OBJECT_CLASS (gst_gl_base_filter_parent_class)->finalize (object); -} - -static void gst_gl_base_filter_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { @@ -424,6 +409,11 @@ gst_gl_base_filter_change_state (GstElement * element, switch (transition) { case GST_STATE_CHANGE_READY_TO_NULL: + if (filter->priv->other_context) { + gst_object_unref (filter->priv->other_context); + filter->priv->other_context = NULL; + } + if (filter->display) { gst_object_unref (filter->display); filter->display = NULL;