From: Wim Taymans Date: Sat, 25 Jun 2005 19:37:59 +0000 (+0000) Subject: gst/: Right, two problems here: ghostpads don't take locks and glib _rec_mutex_lock_f... X-Git-Tag: RELEASE-0_9_2~364 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97194517fe9e9dfe301cd040eea1c7840a0aade8;p=platform%2Fupstream%2Fgstreamer.git gst/: Right, two problems here: ghostpads don't take locks and glib _rec_mutex_lock_full() with depth==0 still locks. 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/gsttask.h: Right, two problems here: ghostpads don't take locks and glib _rec_mutex_lock_full() with depth==0 still locks. Catch illegal locking and g_warn them. --- diff --git a/ChangeLog b/ChangeLog index 50aedbd..883ace2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2005-06-25 Wim Taymans + * 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/gsttask.h: + Right, two problems here: ghostpads don't take locks and + glib _rec_mutex_lock_full() with depth==0 still locks. + Catch illegal locking and g_warn them. + +2005-06-25 Wim Taymans + * check/states/sinks.c: (START_TEST), (gst_object_suite): Have to check for completion now... diff --git a/gst/base/gstbasesink.c b/gst/base/gstbasesink.c index c0e0d53..4921178 100644 --- a/gst/base/gstbasesink.c +++ b/gst/base/gstbasesink.c @@ -466,6 +466,11 @@ gst_basesink_handle_object (GstBaseSink * basesink, GstPad * pad, /* have to release STREAM_LOCK as we cannot take the STATE_LOCK * inside the STREAM_LOCK */ t = GST_STREAM_UNLOCK_FULL (pad); + GST_DEBUG ("released stream lock %d times", t); + if (t == 0) { + GST_WARNING ("STREAM_LOCK should have been locked !!"); + g_warning ("STREAM_LOCK should have been locked !!"); + } /* now we commit our state */ GST_STATE_LOCK (basesink); @@ -474,7 +479,9 @@ gst_basesink_handle_object (GstBaseSink * basesink, GstPad * pad, GST_STATE_UNLOCK (basesink); /* reacquire stream lock, pad could be flushing now */ - GST_STREAM_LOCK_FULL (pad, t); + /* FIXME in glib, if t==0, the lock is still taken... hmmm */ + if (t > 0) + GST_STREAM_LOCK_FULL (pad, t); GST_LOCK (pad); if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad))) diff --git a/gst/gsttask.h b/gst/gsttask.h index 6bed518..a42dbb8 100644 --- a/gst/gsttask.h +++ b/gst/gsttask.h @@ -57,6 +57,8 @@ typedef enum { #define GST_TASK_GET_LOCK(task) (GST_TASK_CAST(task)->lock) #define GST_TASK_LOCK(task) g_static_rec_mutex_lock(GST_TASK_GET_LOCK(task)) #define GST_TASK_UNLOCK(task) g_static_rec_mutex_unlock(GST_TASK_GET_LOCK(task)) +#define GST_TASK_UNLOCK_FULL(task) g_static_rec_mutex_unlock_full(GST_TASK_GET_LOCK(task)) +#define GST_TASK_LOCK_FULL(task,t) g_static_rec_mutex_lock_full(GST_TASK_GET_LOCK(task),(t)) struct _GstTask { GstObject object; diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index c0e0d53..4921178 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -466,6 +466,11 @@ gst_basesink_handle_object (GstBaseSink * basesink, GstPad * pad, /* have to release STREAM_LOCK as we cannot take the STATE_LOCK * inside the STREAM_LOCK */ t = GST_STREAM_UNLOCK_FULL (pad); + GST_DEBUG ("released stream lock %d times", t); + if (t == 0) { + GST_WARNING ("STREAM_LOCK should have been locked !!"); + g_warning ("STREAM_LOCK should have been locked !!"); + } /* now we commit our state */ GST_STATE_LOCK (basesink); @@ -474,7 +479,9 @@ gst_basesink_handle_object (GstBaseSink * basesink, GstPad * pad, GST_STATE_UNLOCK (basesink); /* reacquire stream lock, pad could be flushing now */ - GST_STREAM_LOCK_FULL (pad, t); + /* FIXME in glib, if t==0, the lock is still taken... hmmm */ + if (t > 0) + GST_STREAM_LOCK_FULL (pad, t); GST_LOCK (pad); if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))