change the chainwrapper to allow removing pads during iterations

Original commit message from CVS:
change the chainwrapper to allow removing pads during iterations
This commit is contained in:
Benjamin Otte 2003-11-22 19:11:58 +00:00
parent b90165ef48
commit cb853c1bcf

View file

@ -314,6 +314,7 @@ gst_basic_scheduler_loopfunc_wrapper (int argc, char **argv)
static int
gst_basic_scheduler_chain_wrapper (int argc, char **argv)
{
GSList *already_iterated = NULL;
GstElement *element = GST_ELEMENT_CAST (argv);
G_GNUC_UNUSED const gchar *name = GST_ELEMENT_NAME (element);
@ -323,20 +324,22 @@ gst_basic_scheduler_chain_wrapper (int argc, char **argv)
gst_object_ref (GST_OBJECT (element));
do {
GList *pads = element->pads;
GList *pads;
do {
pads = element->pads;
while (pads) {
GstPad *pad = GST_PAD (pads->data);
GstRealPad *realpad;
pads = g_list_next (pads);
if (!GST_IS_REAL_PAD (pad))
continue;
realpad = GST_REAL_PAD_CAST (pad);
realpad = GST_REAL_PAD (pad);
if (GST_RPAD_DIRECTION (realpad) == GST_PAD_SINK &&
GST_PAD_IS_LINKED (realpad)) {
GST_PAD_IS_LINKED (realpad) &&
g_slist_find (already_iterated, pad) == NULL) {
GstData *data;
GST_CAT_DEBUG (debug_dataflow, "pulling data from %s:%s", name,
@ -354,8 +357,14 @@ gst_basic_scheduler_chain_wrapper (int argc, char **argv)
"calling chain function of element %s done", name);
}
}
already_iterated = g_slist_prepend (already_iterated, pad);
break;
}
pads = g_list_next (pads);
}
} while (pads != NULL);
g_slist_free (already_iterated);
already_iterated = NULL;
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING (element));
GST_FLAG_UNSET (element, GST_ELEMENT_COTHREAD_STOPPING);