From a8d29e1f82a17ed2f4a482c22cb36927c2f14460 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Thu, 25 Jan 2007 14:02:37 +0000 Subject: [PATCH] gst/playback/gstdecodebin2.c: Free GstDecodeGroups no longer used. Original commit message from CVS: * gst/playback/gstdecodebin2.c: (gst_decode_bin_dispose),(gst_decode_bin_finalize): Free GstDecodeGroups no longer used. (gst_decode_group_expose): Don't unlock too many times ! (deactivate_free_recursive): Free iterator once we're done with it. Fix for recursively deactivating elements (stop at ghostpads). --- ChangeLog | 11 +++++++++++ gst/playback/gstdecodebin2.c | 31 +++++++++++++++++++++---------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 53129292ff..af6cbc8298 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-01-25 Edward Hervey + + * gst/playback/gstdecodebin2.c: + (gst_decode_bin_dispose),(gst_decode_bin_finalize): + Free GstDecodeGroups no longer used. + (gst_decode_group_expose): + Don't unlock too many times ! + (deactivate_free_recursive): + Free iterator once we're done with it. + Fix for recursively deactivating elements (stop at ghostpads). + 2007-01-25 Tim-Philipp Müller * gst/playback/gstplaybin.c: (handoff): diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index eb0dec0684..f1005c532e 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -473,6 +473,7 @@ static void gst_decode_bin_dispose (GObject * object) { GstDecodeBin *decode_bin; + GList *tmp; decode_bin = GST_DECODE_BIN (object); @@ -481,6 +482,19 @@ gst_decode_bin_dispose (GObject * object) decode_bin->factories = NULL; /* FILLME */ + + if (decode_bin->activegroup) { + gst_decode_group_free (decode_bin->activegroup); + decode_bin->activegroup = NULL; + } + + /* remove groups */ + for (tmp = decode_bin->groups; tmp; tmp = g_list_next (tmp)) { + GstDecodeGroup *group = (GstDecodeGroup *) tmp->data; + + gst_decode_group_free (group); + } + if (decode_bin->caps) gst_caps_unref (decode_bin->caps); decode_bin->caps = NULL; @@ -497,10 +511,6 @@ gst_decode_bin_finalize (GObject * object) decode_bin = GST_DECODE_BIN (object); if (decode_bin->lock) { - DECODE_BIN_LOCK (decode_bin); - GST_DEBUG_OBJECT (object, "About to free mutex from stream %p", - g_thread_self ()); - DECODE_BIN_UNLOCK (decode_bin); g_mutex_free (decode_bin->lock); decode_bin->lock = NULL; } @@ -1501,20 +1511,17 @@ gst_decode_group_expose (GstDecodeGroup * group) if (group->dbin->activegroup) { GST_DEBUG_OBJECT (group->dbin, "A group is already active and exposed"); - DECODE_BIN_UNLOCK (group->dbin); return TRUE; } if (group->dbin->activegroup == group) { GST_WARNING ("Group %p is already exposed", group); - DECODE_BIN_UNLOCK (group->dbin); return TRUE; } if (!group->dbin->groups || (group != (GstDecodeGroup *) group->dbin->groups->data)) { GST_WARNING ("Group %p is not the first group to expose", group); - DECODE_BIN_UNLOCK (group->dbin); return FALSE; } @@ -1637,10 +1644,12 @@ restart: GstPad *peerpad = NULL; if ((peerpad = gst_pad_get_peer (pad))) { - GstElement *peerelement = GST_ELEMENT (gst_pad_get_parent (peerpad)); + GstObject *parent = gst_pad_get_parent (peerpad); - if (peerelement) - deactivate_free_recursive (group, peerelement); + if (parent && GST_IS_ELEMENT (parent)) + deactivate_free_recursive (group, GST_ELEMENT (parent)); + if (parent) + gst_object_unref (parent); } } break; @@ -1654,6 +1663,8 @@ done: gst_bin_remove (GST_BIN (group->dbin), element); beach: + gst_iterator_free (it); + return; }