Commit 3fc8ad08 authored by Wim Taymans's avatar Wim Taymans

- an element also has a failed state change if the scheduler setup failed.

Original commit message from CVS:
- an element also has a failed state change if the scheduler setup failed.
- set a thread to _STATE_NULL before destroying it.
parent eaba0a07
......@@ -2113,6 +2113,14 @@ gst_element_change_state (GstElement *element)
gst_element_state_get_name (old_state),
gst_element_state_get_name (GST_STATE (element)));
/* tell the scheduler if we have one */
if (element->sched) {
if (gst_scheduler_state_transition (element->sched, element,
old_transition) != GST_STATE_SUCCESS) {
goto failure;
}
}
g_signal_emit (G_OBJECT (element), gst_element_signals[STATE_CHANGE],
0, old_state, GST_STATE (element));
......@@ -2122,20 +2130,11 @@ gst_element_change_state (GstElement *element)
GST_STATE (element), element);
}
/* signal the state change in case somebody is waiting for us */
g_mutex_lock (element->state_mutex);
g_cond_signal (element->state_cond);
g_mutex_unlock (element->state_mutex);
/* tell the scheduler if we have one */
if (element->sched) {
if (gst_scheduler_state_transition (element->sched, element,
old_transition) != GST_STATE_SUCCESS) {
goto failure;
}
}
return GST_STATE_SUCCESS;
failure:
......
......@@ -197,6 +197,14 @@ gst_thread_dispose (GObject *object)
GST_DEBUG (GST_CAT_REFCOUNTING, "dispose");
g_mutex_lock (thread->lock);
if (GST_STATE (thread) != GST_STATE_NULL) {
GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING);
}
g_mutex_unlock (thread->lock);
gst_element_set_state (GST_ELEMENT (thread), GST_STATE_NULL);
g_mutex_free (thread->lock);
g_cond_free (thread->cond);
......@@ -659,7 +667,7 @@ gst_thread_main_loop (void *arg)
GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING);
}
/* looks like we were stopped because of a statechange */
if (GST_STATE_PENDING (thread)) {
if (GST_STATE_PENDING (thread) != GST_STATE_VOID_PENDING) {
gst_thread_update_state (thread);
}
/* once we're here, SPINNING has stopped, we should signal that we're done */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment