mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 21:21:12 +00:00
gst/: Backported some debug logging from a reverted patch
Original commit message from CVS: * gst/gstbin.c: (gst_bin_get_type), (gst_bin_child_state_change_func): * gst/gstthread.c: (gst_thread_change_state): Backported some debug logging from a reverted patch Don't try to destroy the thread twice. Added some more debugging in GstThread. Unlock and signal even if we are in the thread context.
This commit is contained in:
parent
96960abd64
commit
2bb8691df2
3 changed files with 51 additions and 16 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2004-08-03 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/gstbin.c: (gst_bin_get_type),
|
||||
(gst_bin_child_state_change_func):
|
||||
* gst/gstthread.c: (gst_thread_change_state):
|
||||
Backported some debug logging from a reverted patch
|
||||
Don't try to destroy the thread twice. Added some more
|
||||
debugging in GstThread. Unlock and signal even if we
|
||||
are in the thread context.
|
||||
|
||||
2004-08-03 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* po/uk.po:
|
||||
|
|
15
gst/gstbin.c
15
gst/gstbin.c
|
@ -34,6 +34,15 @@
|
|||
#include "gstindex.h"
|
||||
#include "gstutils.h"
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (bin_debug);
|
||||
#define GST_CAT_DEFAULT bin_debug
|
||||
#define GST_LOG_BIN_CONTENTS(bin, text) GST_LOG_OBJECT ((bin), \
|
||||
text ": %d elements: %u PLAYING, %u PAUSED, %u READY, %u NULL, own state: %s", \
|
||||
(bin)->numchildren, (guint) (bin)->child_states[3], \
|
||||
(guint) (bin)->child_states[2], (bin)->child_states[1], \
|
||||
(bin)->child_states[0], gst_element_state_get_name (GST_STATE (bin)))
|
||||
|
||||
|
||||
static GstElementDetails gst_bin_details = GST_ELEMENT_DETAILS ("Generic bin",
|
||||
"Generic/Bin",
|
||||
"Simple container object",
|
||||
|
@ -116,6 +125,9 @@ gst_bin_get_type (void)
|
|||
|
||||
_gst_bin_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstBin", &bin_info, 0);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (bin_debug, "bin", GST_DEBUG_BOLD,
|
||||
"debugging info for the 'bin' container element");
|
||||
}
|
||||
return _gst_bin_type;
|
||||
}
|
||||
|
@ -685,6 +697,7 @@ gst_bin_child_state_change_func (GstBin * bin, GstElementState oldstate,
|
|||
new_idx++;
|
||||
|
||||
GST_LOCK (bin);
|
||||
GST_LOG_BIN_CONTENTS (bin, "before child state change");
|
||||
bin->child_states[old_idx]--;
|
||||
bin->child_states[new_idx]++;
|
||||
|
||||
|
@ -703,11 +716,13 @@ gst_bin_child_state_change_func (GstBin * bin, GstElementState oldstate,
|
|||
g_warning ("%s: state change in callback %d %d",
|
||||
GST_ELEMENT_NAME (bin), state, GST_STATE (bin));
|
||||
}
|
||||
GST_LOG_BIN_CONTENTS (bin, "after child state change");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
GST_LOG_BIN_CONTENTS (bin, "after child state change");
|
||||
GST_UNLOCK (bin);
|
||||
}
|
||||
|
||||
|
|
|
@ -482,27 +482,37 @@ gst_thread_change_state (GstElement * element)
|
|||
by ourself (ouch) */
|
||||
GST_LOG_OBJECT (thread, "destroying GThread %p", thread->thread_id);
|
||||
GST_FLAG_SET (thread, GST_THREAD_STATE_REAPING);
|
||||
/* thread was already gone */
|
||||
if (thread->thread_id != NULL) {
|
||||
thread->thread_id = NULL;
|
||||
if (thread == gst_thread_get_current ()) {
|
||||
/* or should we continue? */
|
||||
g_warning
|
||||
("Thread %s is destroying itself. Function call will not return!",
|
||||
GST_LOG_OBJECT (thread,
|
||||
"Thread %s is destroying itself. Function call will not return!",
|
||||
GST_ELEMENT_NAME (thread));
|
||||
gst_scheduler_reset (GST_ELEMENT_SCHED (thread));
|
||||
|
||||
/* unlock and signal - we are out */
|
||||
gst_thread_release (thread);
|
||||
/* unlock and signal - we are out, note that gst_thread_release does
|
||||
* nothing when we are running in the thread context */
|
||||
GST_DEBUG_OBJECT (thread, "releasing lock");
|
||||
g_cond_signal (thread->cond);
|
||||
g_mutex_unlock (thread->lock);
|
||||
|
||||
GST_INFO_OBJECT (thread, "GThread %p is exiting", g_thread_self ());
|
||||
|
||||
g_signal_emit (G_OBJECT (thread), gst_thread_signals[SHUTDOWN], 0);
|
||||
|
||||
g_thread_exit (NULL);
|
||||
return GST_STATE_SUCCESS;
|
||||
}
|
||||
/* now wait for the thread to destroy itself */
|
||||
GST_DEBUG_OBJECT (thread, "signal");
|
||||
g_cond_signal (thread->cond);
|
||||
GST_DEBUG_OBJECT (thread, "wait");
|
||||
g_cond_wait (thread->cond, thread->lock);
|
||||
GST_DEBUG_OBJECT (thread, "done");
|
||||
/* it should be dead now */
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue