- 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.
diff --git a/gst/gstelement.c b/gst/gstelement.c
index e226ba4..a16fa93 100644
--- a/gst/gstelement.c
+++ b/gst/gstelement.c
@@ -2269,7 +2269,8 @@
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 @@
}
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_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:
diff --git a/gst/gstthread.c b/gst/gstthread.c
index 0c40f98..74e4be6 100644
--- a/gst/gstthread.c
+++ b/gst/gstthread.c
@@ -363,6 +363,7 @@
}
g_assert (!GST_FLAG_IS_SET (thread, GST_THREAD_STATE_SPINNING));
}
+
static void
gst_thread_release (GstThread *thread)
{
@@ -371,6 +372,7 @@
g_mutex_unlock (thread->lock);
}
}
+
static GstElementStateReturn
gst_thread_change_state (GstElement *element)
{
@@ -493,7 +495,7 @@
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 @@
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 @@
}
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);
}