- remove some \n in GstThread debugging

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.
This commit is contained in:
Wim Taymans 2003-04-26 14:38:18 +00:00
parent fa69e9954c
commit a6766132e6
2 changed files with 12 additions and 9 deletions

View file

@ -2269,7 +2269,8 @@ gst_element_set_state (GstElement *element, GstElementState state)
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;
}
break;
default:
@ -2279,6 +2280,11 @@ gst_element_set_state (GstElement *element, GstElementState state)
}
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);
return return_val;
}
@ -2460,11 +2466,6 @@ 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);
return GST_STATE_SUCCESS;
failure:

View file

@ -363,6 +363,7 @@ gst_thread_catch (GstThread *thread)
}
g_assert (!GST_FLAG_IS_SET (thread, GST_THREAD_STATE_SPINNING));
}
static void
gst_thread_release (GstThread *thread)
{
@ -371,6 +372,7 @@ gst_thread_release (GstThread *thread)
g_mutex_unlock (thread->lock);
}
}
static GstElementStateReturn
gst_thread_change_state (GstElement *element)
{
@ -493,7 +495,7 @@ static void
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),
@ -535,7 +537,7 @@ gst_thread_main_loop (void *arg)
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));
@ -549,7 +551,7 @@ gst_thread_main_loop (void *arg)
}
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);
}