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));
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:
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);
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 */