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
This commit is contained in:
Matthew Waters 2015-04-27 15:20:56 +10:00
parent 52a40dfc48
commit 8930bf7c07

View file

@ -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;
@ -313,19 +309,6 @@ gst_gl_base_mixer_init (GstGLBaseMixer * mix)
gst_gl_base_mixer_reset (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)
{
@ -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;
}