gst/: Right, two problems here: ghostpads don't take locks and glib _rec_mutex_lock_f...
authorWim Taymans <wim.taymans@gmail.com>
Sat, 25 Jun 2005 19:37:59 +0000 (19:37 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Sat, 25 Jun 2005 19:37:59 +0000 (19:37 +0000)
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.

ChangeLog
gst/base/gstbasesink.c
gst/gsttask.h
libs/gst/base/gstbasesink.c

index 50aedbd..883ace2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2005-06-25  Wim Taymans  <wim@fluendo.com>
 
+       * 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  <wim@fluendo.com>
+
        * check/states/sinks.c: (START_TEST), (gst_object_suite):
        Have to check for completion now...
 
index c0e0d53..4921178 100644 (file)
@@ -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)))
index 6bed518..a42dbb8 100644 (file)
@@ -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;
index c0e0d53..4921178 100644 (file)
@@ -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)))