mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 11:11:08 +00:00
gst/gstthread.c: Lock the iteration and the state change so that automatic negotiation and fixation does not happen a...
Original commit message from CVS: * gst/gstthread.c: (gst_thread_init), (gst_thread_change_state), (gst_thread_main_loop): Lock the iteration and the state change so that automatic negotiation and fixation does not happen at the same time as the in stream negotiation.
This commit is contained in:
parent
7520601a63
commit
031d317274
3 changed files with 16 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
|||
2004-10-06 Wim Taymans <wim at fluendo dot com>
|
||||
|
||||
* gst/gstthread.c: (gst_thread_init), (gst_thread_change_state),
|
||||
(gst_thread_main_loop):
|
||||
Lock the iteration and the state change so that automatic
|
||||
negotiation and fixation does not happen at the same time
|
||||
as the in stream negotiation.
|
||||
|
||||
2004-10-05 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* configure.ac:
|
||||
|
|
|
@ -206,6 +206,7 @@ gst_thread_init (GTypeInstance * instance, gpointer g_class)
|
|||
|
||||
thread->lock = g_mutex_new ();
|
||||
thread->cond = g_cond_new ();
|
||||
thread->iterate_lock = g_mutex_new ();
|
||||
|
||||
thread->thread_id = (GThread *) NULL; /* set in NULL -> READY */
|
||||
thread->priority = G_THREAD_PRIORITY_NORMAL;
|
||||
|
@ -552,11 +553,13 @@ gst_thread_change_state (GstElement * element)
|
|||
GST_LOG_OBJECT (thread, "unlocking lock");
|
||||
g_mutex_unlock (thread->lock);
|
||||
|
||||
g_mutex_lock (thread->iterate_lock);
|
||||
if (GST_ELEMENT_CLASS (parent_class)->change_state) {
|
||||
ret = GST_ELEMENT_CLASS (parent_class)->change_state (GST_ELEMENT (thread));
|
||||
} else {
|
||||
ret = GST_STATE_SUCCESS;
|
||||
}
|
||||
g_mutex_unlock (thread->iterate_lock);
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -664,7 +667,9 @@ gst_thread_main_loop (void *arg)
|
|||
gboolean status;
|
||||
|
||||
g_mutex_unlock (thread->lock);
|
||||
g_mutex_lock (thread->iterate_lock);
|
||||
status = gst_bin_iterate (GST_BIN (thread));
|
||||
g_mutex_unlock (thread->iterate_lock);
|
||||
g_mutex_lock (thread->lock);
|
||||
|
||||
if (!status) {
|
||||
|
|
|
@ -61,7 +61,9 @@ struct _GstThread {
|
|||
GMutex *lock; /* thread lock/condititon pairs */
|
||||
GCond *cond; /* used to control the thread */
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
GMutex *iterate_lock; /* lock iteration in state change */
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING-1];
|
||||
};
|
||||
|
||||
struct _GstThreadClass {
|
||||
|
|
Loading…
Reference in a new issue