summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2003-04-26 14:38:18 +0000
committerWim Taymans <wim.taymans@gmail.com>2003-04-26 14:38:18 +0000
commita6766132e65d0ea5fbedcb0644b7ec0488d5a632 (patch)
tree62642611d32b44a4ef1d337fb33ebc6f1e87f7a0
parentfa69e9954cc2423da44cfa6f9dab3f021d1afa6b (diff)
- 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.
-rw-r--r--gst/gstelement.c13
-rw-r--r--gst/gstthread.c8
2 files changed, 12 insertions, 9 deletions
diff --git a/gst/gstelement.c b/gst/gstelement.c
index e226ba46e..a16fa9366 100644
--- a/gst/gstelement.c
+++ b/gst/gstelement.c
@@ -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:
diff --git a/gst/gstthread.c b/gst/gstthread.c
index 0c40f9873..74e4be6c9 100644
--- a/gst/gstthread.c
+++ b/gst/gstthread.c
@@ -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);
}