Commit de6bcd89 authored by Erik Walthinsen's avatar Erik Walthinsen
Browse files

- added 'remove' argument to _chain_recursive_add to remove elements from old...

- added 'remove' argument to _chain_recursive_add to remove elements from old chain before adding to new one

Original commit message from CVS:
- added 'remove' argument to _chain_recursive_add to remove elements from
old chain before adding to new one
- reworked _pad_unlink to be simpler and more correct
parent cbbb8371
......@@ -936,7 +936,7 @@ gst_basic_scheduler_find_chain (GstBasicScheduler * sched, GstElement * element)
}
static void
gst_basic_scheduler_chain_recursive_add (GstSchedulerChain * chain, GstElement * element)
gst_basic_scheduler_chain_recursive_add (GstSchedulerChain * chain, GstElement * element, gboolean remove)
{
GList *pads;
GstPad *pad;
......@@ -945,9 +945,13 @@ gst_basic_scheduler_chain_recursive_add (GstSchedulerChain * chain, GstElement *
/* check to see if it's in a chain already */
prevchain = gst_basic_scheduler_find_chain (chain->sched, element);
/* if it's already in another chain, we're done */
if (prevchain != NULL)
return;
/* if it's already in another chain, either remove or punt */
if (prevchain != NULL) {
if (remove == TRUE)
gst_basic_scheduler_chain_remove_element (prevchain, element);
else
return;
}
/* add it to this one */
gst_basic_scheduler_chain_add_element (chain, element);
......@@ -968,7 +972,7 @@ gst_basic_scheduler_chain_recursive_add (GstSchedulerChain * chain, GstElement *
if (GST_ELEMENT_SCHED (GST_PAD_PARENT (pad)) == GST_ELEMENT_SCHED (peerelement)) {
GST_DEBUG (GST_CAT_SCHEDULING, "peer \"%s\" is valid for same chain",
GST_ELEMENT_NAME (peerelement));
gst_basic_scheduler_chain_recursive_add (chain, peerelement);
gst_basic_scheduler_chain_recursive_add (chain, peerelement, remove);
}
}
}
......@@ -1213,6 +1217,7 @@ gst_basic_scheduler_pad_unlink (GstScheduler * sched, GstPad * srcpad, GstPad *
chain1 = gst_basic_scheduler_find_chain (bsched, element1);
chain2 = gst_basic_scheduler_find_chain (bsched, element2);
#if 0
if (chain1 != chain2) {
/* elements not in the same chain don't need to be separated */
GST_INFO (GST_CAT_SCHEDULING, "elements not in the same chain");
......@@ -1225,14 +1230,22 @@ gst_basic_scheduler_pad_unlink (GstScheduler * sched, GstPad * srcpad, GstPad *
/* now create a new chain to hold element1 and build it from scratch */
chain1 = gst_basic_scheduler_chain_new (bsched);
gst_basic_scheduler_chain_recursive_add (chain1, element1);
gst_basic_scheduler_chain_recursive_add (chain1, element1, FALSE);
}
/* check the other element to see if it landed in the newly created chain */
if (gst_basic_scheduler_find_chain (bsched, element2) == NULL) {
/* if not in chain, create chain and build from scratch */
chain2 = gst_basic_scheduler_chain_new (bsched);
gst_basic_scheduler_chain_recursive_add (chain2, element2);
gst_basic_scheduler_chain_recursive_add (chain2, element2, FALSE);
}
#endif
/* if they're both in the same chain, move second set of elements to a new chain */
if (chain1 && (chain1 == chain2)) {
GST_INFO (GST_CAT_SCHEDULING, "creating new chain for second element and peers");
chain2 = gst_basic_scheduler_chain_new (bsched);
gst_basic_scheduler_chain_recursive_add (chain2, element2, TRUE);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment