mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
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:
parent
aeaadc9696
commit
f8ca62be6e
1 changed files with 11 additions and 1 deletions
12
gst/gstbin.c
12
gst/gstbin.c
|
@ -526,20 +526,30 @@ gst_bin_change_state (GstElement * element)
|
||||||
children = bin->children;
|
children = bin->children;
|
||||||
|
|
||||||
while (children) {
|
while (children) {
|
||||||
|
GstElementState old_child_state;
|
||||||
|
|
||||||
child = GST_ELEMENT (children->data);
|
child = GST_ELEMENT (children->data);
|
||||||
children = g_list_next (children);
|
children = g_list_next (children);
|
||||||
|
|
||||||
|
old_child_state = GST_STATE (child);
|
||||||
|
|
||||||
switch (gst_element_set_state (child, pending)) {
|
switch (gst_element_set_state (child, pending)) {
|
||||||
case GST_STATE_FAILURE:
|
case GST_STATE_FAILURE:
|
||||||
GST_STATE_PENDING (element) = GST_STATE_VOID_PENDING;
|
GST_STATE_PENDING (element) = GST_STATE_VOID_PENDING;
|
||||||
GST_DEBUG (GST_CAT_STATES, "child '%s' failed to go to state %d(%s)",
|
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_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)) {
|
if (GST_ELEMENT_SCHED (child) == GST_ELEMENT_SCHED (element)) {
|
||||||
/* reset to what is was */
|
/* reset to what is was */
|
||||||
GST_STATE_PENDING (element) = old_state;
|
GST_STATE_PENDING (element) = old_state;
|
||||||
|
|
||||||
gst_bin_change_state (element);
|
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;
|
return GST_STATE_FAILURE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue