Original commit message from CVS:
- remove some \n in GstThread debugging
- move the state change g_cond_signal to the set_state function to make
sure that we don't unlock the waiters before we completed the state
change.
gst_element_state_get_name (curpending),
gst_element_state_get_name (GST_STATE (element)),
gst_element_state_get_name (GST_STATE_PENDING (element)));
gst_element_state_get_name (curpending),
gst_element_state_get_name (GST_STATE (element)),
gst_element_state_get_name (GST_STATE_PENDING (element)));
- return GST_STATE_FAILURE;
+ return_val = GST_STATE_FAILURE;
+ goto exit;
+ /* 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);
+
GST_STATE (element), 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);
-
return GST_STATE_SUCCESS;
failure:
return GST_STATE_SUCCESS;
failure:
}
g_assert (!GST_FLAG_IS_SET (thread, GST_THREAD_STATE_SPINNING));
}
}
g_assert (!GST_FLAG_IS_SET (thread, GST_THREAD_STATE_SPINNING));
}
static void
gst_thread_release (GstThread *thread)
{
static void
gst_thread_release (GstThread *thread)
{
g_mutex_unlock (thread->lock);
}
}
g_mutex_unlock (thread->lock);
}
}
static GstElementStateReturn
gst_thread_change_state (GstElement *element)
{
static GstElementStateReturn
gst_thread_change_state (GstElement *element)
{
gst_thread_child_state_change (GstBin *bin, GstElementState oldstate,
GstElementState newstate, GstElement *element)
{
gst_thread_child_state_change (GstBin *bin, GstElementState oldstate,
GstElementState newstate, GstElement *element)
{
- GST_DEBUG (GST_CAT_THREAD, "%s (from thread %s) child %s changed state from %s to %s\n",
+ GST_DEBUG (GST_CAT_THREAD, "%s (from thread %s) child %s changed state from %s to %s",
GST_ELEMENT_NAME (bin),
gst_thread_get_current() ? GST_ELEMENT_NAME (gst_thread_get_current()) : "(none)",
GST_ELEMENT_NAME (element), gst_element_state_get_name (oldstate),
GST_ELEMENT_NAME (bin),
gst_thread_get_current() ? GST_ELEMENT_NAME (gst_thread_get_current()) : "(none)",
GST_ELEMENT_NAME (element), gst_element_state_get_name (oldstate),
if (GST_STATE (thread) == GST_STATE_PLAYING) {
GST_FLAG_SET (thread, GST_THREAD_STATE_SPINNING);
status = TRUE;
if (GST_STATE (thread) == GST_STATE_PLAYING) {
GST_FLAG_SET (thread, GST_THREAD_STATE_SPINNING);
status = TRUE;
- GST_DEBUG (GST_CAT_THREAD, "%s starts iterating\n", GST_ELEMENT_NAME (thread));
+ GST_DEBUG (GST_CAT_THREAD, "%s starts iterating", GST_ELEMENT_NAME (thread));
while (status && GST_FLAG_IS_SET (thread, GST_THREAD_STATE_SPINNING)) {
g_mutex_unlock (thread->lock);
status = gst_bin_iterate (GST_BIN (thread));
while (status && GST_FLAG_IS_SET (thread, GST_THREAD_STATE_SPINNING)) {
g_mutex_unlock (thread->lock);
status = gst_bin_iterate (GST_BIN (thread));
}
if (GST_FLAG_IS_SET (thread, GST_THREAD_STATE_REAPING))
break;
}
if (GST_FLAG_IS_SET (thread, GST_THREAD_STATE_REAPING))
break;
- GST_DEBUG (GST_CAT_THREAD, "%s was caught\n", GST_ELEMENT_NAME (thread));
+ GST_DEBUG (GST_CAT_THREAD, "%s was caught", GST_ELEMENT_NAME (thread));
g_cond_signal (thread->cond);
g_cond_wait (thread->cond, thread->lock);
}
g_cond_signal (thread->cond);
g_cond_wait (thread->cond, thread->lock);
}