diff options
author | Matthew Waters <matthew@centricular.com> | 2015-06-13 18:43:04 +1000 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2015-06-13 18:47:13 +1000 |
commit | 4796cef882569c772e497584a3472dfce6e66a70 (patch) | |
tree | 4b493f0f3af0760b212c8322eb347ecf6c7dbfb7 | |
parent | c72213ff8b73d5bafbc83fd87e8273647607e967 (diff) |
glmixerbin: implement proper dynamic pad removal
https://bugzilla.gnome.org/show_bug.cgi?id=750881
-rw-r--r-- | ext/gl/gstglmixerbin.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/ext/gl/gstglmixerbin.c b/ext/gl/gstglmixerbin.c index 75816e149..f56aad6ea 100644 --- a/ext/gl/gstglmixerbin.c +++ b/ext/gl/gstglmixerbin.c @@ -47,19 +47,17 @@ _free_input_chain (struct input_chain *chain) if (!chain) return; - if (chain->ghost_pad) - gst_object_unref (chain->ghost_pad); chain->ghost_pad = NULL; if (chain->upload) { + gst_element_set_state (chain->upload, GST_STATE_NULL); gst_bin_remove (GST_BIN (chain->self), chain->upload); - gst_object_unref (chain->upload); chain->upload = NULL; } if (chain->in_convert) { + gst_element_set_state (chain->in_convert, GST_STATE_NULL); gst_bin_remove (GST_BIN (chain->self), chain->in_convert); - gst_object_unref (chain->in_convert); chain->in_convert = NULL; } @@ -449,21 +447,25 @@ gst_gl_mixer_bin_release_pad (GstElement * element, GstPad * pad) { GstGLMixerBin *self = GST_GL_MIXER_BIN (element); GList *l = self->priv->input_chains; + gboolean released = FALSE; GST_OBJECT_LOCK (element); while (l) { struct input_chain *chain = l->data; - if (chain->mixer_pad == pad) { - _free_input_chain (chain); + if (GST_PAD (chain->ghost_pad) == pad) { self->priv->input_chains = g_list_remove_link (self->priv->input_chains, l); + GST_OBJECT_UNLOCK (element); + + _free_input_chain (chain); + gst_element_remove_pad (element, pad); + released = TRUE; break; } l = l->next; } - GST_OBJECT_UNLOCK (element); - - gst_element_remove_pad (element, pad); + if (!released) + GST_OBJECT_UNLOCK (element); } static GstStateChangeReturn |