mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 05:31:15 +00:00
- 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.
This commit is contained in:
parent
eaba0a07e8
commit
3fc8ad0842
2 changed files with 17 additions and 10 deletions
|
@ -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 */
|
||||
|
|
Loading…
Reference in a new issue