From d7ec4cb787f30bba74d131637cc81bb88738e4cd Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 14 Jul 2004 14:52:49 +0000 Subject: [PATCH] gst/schedulers/gstoptimalscheduler.c: Make sure that a single non-loop-based element does not end up in a group. This... Original commit message from CVS: * gst/schedulers/gstoptimalscheduler.c: (group_dec_link), (gst_opt_scheduler_pad_link), (group_migrate_connected): Make sure that a single non-loop-based element does not end up in a group. This fixes the testsuite again. --- ChangeLog | 7 +++ gst/schedulers/gstoptimalscheduler.c | 64 ++++++++++++++++------------ 2 files changed, 44 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index d608e1c936..131e843f9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-07-14 Wim Taymans + + * gst/schedulers/gstoptimalscheduler.c: (group_dec_link), + (gst_opt_scheduler_pad_link), (group_migrate_connected): + Make sure that a single non-loop-based element does not + end up in a group. This fixes the testsuite again. + 2004-07-14 Wim Taymans * gst/schedulers/gstoptimalscheduler.c: (create_group), diff --git a/gst/schedulers/gstoptimalscheduler.c b/gst/schedulers/gstoptimalscheduler.c index 32ca372e08..23be3b0bb4 100644 --- a/gst/schedulers/gstoptimalscheduler.c +++ b/gst/schedulers/gstoptimalscheduler.c @@ -2324,37 +2324,47 @@ group_migrate_connected (GstOptScheduler * osched, GstElement * element, return NULL; } else if (len == 1) { remove_from_group (group, GST_ELEMENT (connected->data)); - GST_LOG ("not migrating to new group as the group is empty"); + GST_LOG + ("not migrating to new group as the group would only contain 1 element"); g_list_free (connected); + GST_LOG ("new group is old group now"); + new_group = group; + } else { + /* we create a new chain to hold the new group */ + chain = create_chain (osched); + + for (c = connected; c; c = g_list_next (c)) { + GstElement *element = GST_ELEMENT (c->data); + + group = remove_from_group (group, element); + if (new_group == NULL) { + new_group = + create_group (chain, element, GST_OPT_SCHEDULER_GROUP_UNKNOWN); + } else { + add_to_group (new_group, element); + } + } + g_list_free (connected); + + /* remove last element from the group if any. Make sure not to remove + * the loop based entry point of a group as this always needs one group */ + if (group != NULL) { + if (g_slist_length (group->elements) == 1 && + group->type != GST_OPT_SCHEDULER_GROUP_LOOP) { + GST_LOG ("removing last element from old group"); + group = remove_from_group (group, GST_ELEMENT (group->elements->data)); + } + } + } + + if (g_slist_length (new_group->elements) == 1 && + new_group->type != GST_OPT_SCHEDULER_GROUP_LOOP) { + GST_LOG ("removing last element from new group"); + new_group = + remove_from_group (new_group, GST_ELEMENT (new_group->elements->data)); return NULL; } - /* we create a new chain to hold the new group */ - chain = create_chain (osched); - - for (c = connected; c; c = g_list_next (c)) { - GstElement *element = GST_ELEMENT (c->data); - - group = remove_from_group (group, element); - if (new_group == NULL) { - new_group = - create_group (chain, element, GST_OPT_SCHEDULER_GROUP_UNKNOWN); - } else { - add_to_group (new_group, element); - } - } - g_list_free (connected); - - /* remove last element from the group if any. Make sure not to remove - * the loop based entry point of a group as this always needs one group */ - if (group != NULL) { - if (g_slist_length (group->elements) == 1 && - group->type != GST_OPT_SCHEDULER_GROUP_LOOP) { - GST_LOG ("removing last element from group"); - group = remove_from_group (group, GST_ELEMENT (group->elements->data)); - } - } - /* at this point the new group lives in its own chain but might * have to be merged with another chain, this happens when the new * group has a link with another group in another chain */