From: Sebastian Dröge Date: Fri, 25 Sep 2009 09:07:02 +0000 (+0200) Subject: inputselector: Use new single iterator for the internally linked pads X-Git-Tag: RELEASE-0.10.32~89 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ee3931e5da21cef80b29f311ee89205f286751e;p=platform%2Fupstream%2Fgstreamer.git inputselector: Use new single iterator for the internally linked pads This fixes a deadlock and removes some useless code. --- diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c index 3fdba0b..329b130 100644 --- a/plugins/elements/gstinputselector.c +++ b/plugins/elements/gstinputselector.c @@ -320,71 +320,20 @@ gst_selector_pad_reset (GstSelectorPad * pad) /* strictly get the linked pad from the sinkpad. If the pad is active we return * the srcpad else we return NULL */ -typedef struct -{ - GstIterator parent; - - GstPad *pad; - gboolean start; -} GstSelectorIterator; - -static void -_iterate_free (GstIterator * it) -{ - GstSelectorIterator *sit = (GstSelectorIterator *) it; - - gst_object_unref (sit->pad); - g_free (it); -} - -static GstIteratorResult -_iterate_next (GstIterator * it, gpointer * result) -{ - GstSelectorIterator *sit = (GstSelectorIterator *) it; - - if (sit->start) { - GstPad *res = gst_input_selector_get_linked_pad (sit->pad, TRUE); - - *result = res; - sit->start = FALSE; - return GST_ITERATOR_OK; - } - - *result = NULL; - return GST_ITERATOR_DONE; -} - -static GstIteratorItem -_iterate_item (GstIterator * it, gpointer item) -{ - return GST_ITERATOR_ITEM_PASS; -} - -static void -_iterate_resync (GstIterator * it) -{ - GstSelectorIterator *sit = (GstSelectorIterator *) it; - - sit->start = TRUE; -} static GstIterator * gst_selector_pad_iterate_linked_pads (GstPad * pad) { GstInputSelector *sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad)); - GstSelectorIterator *it = (GstSelectorIterator *) - gst_iterator_new (sizeof (GstSelectorIterator), - GST_TYPE_PAD, - sel->lock, - &GST_ELEMENT_CAST (sel)->pads_cookie, - _iterate_next, _iterate_item, _iterate_resync, _iterate_free); - - it->pad = gst_object_ref (pad); - it->start = TRUE; + GstPad *opad = gst_input_selector_get_linked_pad (pad, TRUE); + GstIterator *it = gst_iterator_new_single (GST_TYPE_PAD, opad, + (GstCopyFunction) gst_object_ref, (GFreeFunc) gst_object_unref); + if (opad) + gst_object_unref (opad); gst_object_unref (sel); - return (GstIterator *) it; + return it; } static gboolean