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.
This commit is contained in:
Wim Taymans 2004-07-14 14:52:49 +00:00
parent b997eae215
commit d7ec4cb787
2 changed files with 44 additions and 27 deletions

View file

@ -1,3 +1,10 @@
2004-07-14 Wim Taymans <wim@fluendo.com>
* 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 <wim@fluendo.com>
* gst/schedulers/gstoptimalscheduler.c: (create_group),

View file

@ -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 */