summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d7bad72)
raw | patch | inline | side by side (parent: d7bad72)
author | Thomas Vander Stichele <thomas@apestaart.org> | |
Tue, 20 Jul 2004 09:55:13 +0000 (09:55 +0000) | ||
committer | Thomas Vander Stichele <thomas@apestaart.org> | |
Tue, 20 Jul 2004 09:55:13 +0000 (09:55 +0000) |
Original commit message from CVS:
fix for #147894 (opt scheduler decoupled elements mismanagement)
fix for #147894 (opt scheduler decoupled elements mismanagement)
diff --git a/ChangeLog b/ChangeLog
index 76a232007fa36dfad125fbd8664aab4ac46befcd..439096e31b4b470f6f692ff915f1622570bdbd03 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2004-07-20 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ patch by: Wim Taymans
+
+ * gst/schedulers/gstoptimalscheduler.c: (group_num_elements),
+ (group_has_element), (element_get_reachables_func),
+ (group_migrate_connected):
+ fix for #147894 (opt scheduler decoupled elements mismanagement)
+ * testsuite/schedulers/Makefile.am:
+ testsuite app now passes
+
2004-07-19 Wim Taymans <wim@fluendo.com>
* testsuite/schedulers/147819.c: (handoff_identity1),
index d3860b3a2ad943e689d8d306b6defff87de7f5ea..ac2a0e2d5fbe6fe263ab158553a5cb39adb9f847 100644 (file)
return group;
}
+/* count number of elements in the group. Have to be careful because
+ * decoupled elements are added as entry point but are not added to
+ * the elements list */
+static gint
+group_num_elements (GstOptSchedulerGroup * group)
+{
+ gint num;
+
+ num = group->num_elements;
+ /* decoupled elements are not added to the group but are
+ * added as an entry */
+ if (group->entry) {
+ if (GST_ELEMENT_IS_DECOUPLED (group->entry)) {
+ num++;
+ }
+ }
+ return num;
+}
+
+/* check if an element is part of the given group. We have to be carefull
+ * as decoupled elements are added as entry but are not added to the elements
+ * list */
+static gboolean
+group_has_element (GstOptSchedulerGroup * group, GstElement * element)
+{
+ if (group->entry == element)
+ return TRUE;
+
+ return (g_slist_find (group->elements, element) != NULL);
+}
+
/* FIXME need to check if the groups are of the same type -- otherwise need to
setup the scheduler again, if it is setup */
static GstOptSchedulerGroup *
@@ -2121,7 +2152,7 @@ element_get_reachables_func (GstElement * element, GstOptSchedulerGroup * group,
const GList *pads;
/* if no element or element not in group or been there, return NULL */
- if (element == NULL || g_slist_find (group->elements, element) == NULL ||
+ if (element == NULL || !group_has_element (group, element) ||
GST_ELEMENT_IS_VISITED (element))
return NULL;
gint len;
if (GST_ELEMENT_IS_DECOUPLED (element)) {
+ GST_LOG ("element is decoupled and thus not in the group");
/* the element is decoupled and is therefore not in the group */
return NULL;
}
gst_element_get_name (element));
return NULL;
} else if (len == 1) {
- remove_from_group (group, GST_ELEMENT (connected->data));
+ group = remove_from_group (group, GST_ELEMENT (connected->data));
GST_LOG
("not migrating to new group as the group would only contain 1 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 &&
+ if (group_num_elements (group) == 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;
+ if (new_group != NULL) {
+ if (group_num_elements (new_group) == 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;
+ }
+ /* 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 */
+ rechain_group (new_group);
}
- /* 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 */
- rechain_group (new_group);
return new_group;
}
diff --git a/tests/old/testsuite/schedulers/Makefile.am b/tests/old/testsuite/schedulers/Makefile.am
index 0bb006ddf065e6d03b76e76a03cddbe3843dce5d..5ca979cde013772b845db0ca5846b3aa95ed5c01 100644 (file)
unlink_src unlink_sink \
relink_src relink_sink \
unref_src unref_sink \
- 143777 143777-2 147713
+ 143777 143777-2 147713 147894
# don't enable this one unless it actually works.
# useless_iteration
-tests_fail = 142183 142183-2 147894 147819
+tests_fail = 142183 142183-2 147819
tests_ignore =
unlink_src_SOURCES = unlink.c
index 0bb006ddf065e6d03b76e76a03cddbe3843dce5d..5ca979cde013772b845db0ca5846b3aa95ed5c01 100644 (file)
unlink_src unlink_sink \
relink_src relink_sink \
unref_src unref_sink \
- 143777 143777-2 147713
+ 143777 143777-2 147713 147894
# don't enable this one unless it actually works.
# useless_iteration
-tests_fail = 142183 142183-2 147894 147819
+tests_fail = 142183 142183-2 147819
tests_ignore =
unlink_src_SOURCES = unlink.c