gst/: Unlock STREAM_LOCK whatever the recursion was.

Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_basesink_preroll_queue_empty),
(gst_basesink_handle_object), (gst_basesink_event),
(gst_basesink_do_sync), (gst_basesink_handle_event),
(gst_basesink_change_state):
* gst/gstpad.h:
Unlock STREAM_LOCK whatever the recursion was.
This commit is contained in:
Wim Taymans 2005-06-25 19:09:28 +00:00
parent 8303454db7
commit 613dc3d631
3 changed files with 8 additions and 4 deletions

View file

@ -428,6 +428,7 @@ gst_basesink_handle_object (GstBaseSink * basesink, GstPad * pad,
{ {
gint length; gint length;
gboolean have_event; gboolean have_event;
guint t;
GST_PREROLL_LOCK (pad); GST_PREROLL_LOCK (pad);
/* push object on the queue */ /* push object on the queue */
@ -464,7 +465,7 @@ gst_basesink_handle_object (GstBaseSink * basesink, GstPad * pad,
/* have to release STREAM_LOCK as we cannot take the STATE_LOCK /* have to release STREAM_LOCK as we cannot take the STATE_LOCK
* inside the STREAM_LOCK */ * inside the STREAM_LOCK */
GST_STREAM_UNLOCK (pad); t = GST_STREAM_UNLOCK_FULL (pad);
/* now we commit our state */ /* now we commit our state */
GST_STATE_LOCK (basesink); GST_STATE_LOCK (basesink);
@ -473,7 +474,7 @@ gst_basesink_handle_object (GstBaseSink * basesink, GstPad * pad,
GST_STATE_UNLOCK (basesink); GST_STATE_UNLOCK (basesink);
/* reacquire stream lock, pad could be flushing now */ /* reacquire stream lock, pad could be flushing now */
GST_STREAM_LOCK (pad); GST_STREAM_LOCK_FULL (pad, t);
GST_LOCK (pad); GST_LOCK (pad);
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad))) if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))

View file

@ -267,6 +267,8 @@ struct _GstPadClass {
#define GST_STREAM_LOCK(pad) (g_static_rec_mutex_lock(GST_STREAM_GET_LOCK(pad))) #define GST_STREAM_LOCK(pad) (g_static_rec_mutex_lock(GST_STREAM_GET_LOCK(pad)))
#define GST_STREAM_TRYLOCK(pad) (g_static_rec_mutex_trylock(GST_STREAM_GET_LOCK(pad))) #define GST_STREAM_TRYLOCK(pad) (g_static_rec_mutex_trylock(GST_STREAM_GET_LOCK(pad)))
#define GST_STREAM_UNLOCK(pad) (g_static_rec_mutex_unlock(GST_STREAM_GET_LOCK(pad))) #define GST_STREAM_UNLOCK(pad) (g_static_rec_mutex_unlock(GST_STREAM_GET_LOCK(pad)))
#define GST_STREAM_UNLOCK_FULL(pad) (g_static_rec_mutex_unlock_full(GST_STREAM_GET_LOCK(pad)))
#define GST_STREAM_LOCK_FULL(pad,t) (g_static_rec_mutex_lock_full(GST_STREAM_GET_LOCK(pad), t))
#define GST_PREROLL_GET_LOCK(pad) (GST_PAD_CAST(pad)->preroll_lock) #define GST_PREROLL_GET_LOCK(pad) (GST_PAD_CAST(pad)->preroll_lock)
#define GST_PREROLL_LOCK(pad) (g_mutex_lock(GST_PREROLL_GET_LOCK(pad))) #define GST_PREROLL_LOCK(pad) (g_mutex_lock(GST_PREROLL_GET_LOCK(pad)))

View file

@ -428,6 +428,7 @@ gst_basesink_handle_object (GstBaseSink * basesink, GstPad * pad,
{ {
gint length; gint length;
gboolean have_event; gboolean have_event;
guint t;
GST_PREROLL_LOCK (pad); GST_PREROLL_LOCK (pad);
/* push object on the queue */ /* push object on the queue */
@ -464,7 +465,7 @@ gst_basesink_handle_object (GstBaseSink * basesink, GstPad * pad,
/* have to release STREAM_LOCK as we cannot take the STATE_LOCK /* have to release STREAM_LOCK as we cannot take the STATE_LOCK
* inside the STREAM_LOCK */ * inside the STREAM_LOCK */
GST_STREAM_UNLOCK (pad); t = GST_STREAM_UNLOCK_FULL (pad);
/* now we commit our state */ /* now we commit our state */
GST_STATE_LOCK (basesink); GST_STATE_LOCK (basesink);
@ -473,7 +474,7 @@ gst_basesink_handle_object (GstBaseSink * basesink, GstPad * pad,
GST_STATE_UNLOCK (basesink); GST_STATE_UNLOCK (basesink);
/* reacquire stream lock, pad could be flushing now */ /* reacquire stream lock, pad could be flushing now */
GST_STREAM_LOCK (pad); GST_STREAM_LOCK_FULL (pad, t);
GST_LOCK (pad); GST_LOCK (pad);
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad))) if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))