Only revert the state of the failed element

Original commit message from CVS:
Only revert the state of the failed element
This commit is contained in:
Wim Taymans 2002-06-17 16:00:10 +00:00
parent aeaadc9696
commit f8ca62be6e

View file

@ -526,20 +526,30 @@ gst_bin_change_state (GstElement * element)
children = bin->children;
while (children) {
GstElementState old_child_state;
child = GST_ELEMENT (children->data);
children = g_list_next (children);
old_child_state = GST_STATE (child);
switch (gst_element_set_state (child, pending)) {
case GST_STATE_FAILURE:
GST_STATE_PENDING (element) = GST_STATE_VOID_PENDING;
GST_DEBUG (GST_CAT_STATES, "child '%s' failed to go to state %d(%s)",
GST_ELEMENT_NAME (child), pending, gst_element_state_get_name (pending));
gst_element_set_state (child, old_state);
gst_element_set_state (child, old_child_state);
if (GST_ELEMENT_SCHED (child) == GST_ELEMENT_SCHED (element)) {
/* reset to what is was */
GST_STATE_PENDING (element) = old_state;
gst_bin_change_state (element);
/* see if the old state was set */
if (GST_STATE (element) == old_state)
return GST_STATE_SUCCESS;
/* something wacky happened, we can't even go back */
return GST_STATE_FAILURE;
}
break;