d3dvideosink: Print lock/unlock log with trace debug level
authorSeungha Yang <seungha.yang@navercorp.com>
Tue, 30 Oct 2018 13:49:01 +0000 (22:49 +0900)
committerSebastian Dröge <slomo@coaxion.net>
Tue, 6 Nov 2018 11:51:39 +0000 (11:51 +0000)
sys/d3dvideosink/d3dvideosink.h

index 22b6f29..de0da25 100644 (file)
@@ -75,17 +75,24 @@ struct _GstD3DVideoSinkClass
   GRecMutex   lock;
 };
 
-#if 1
-# define LOCK_SINK(sink)          g_rec_mutex_lock(&sink->lock);
-# define UNLOCK_SINK(sink)        g_rec_mutex_unlock(&sink->lock);
-# define LOCK_CLASS(obj, klass)   g_rec_mutex_lock(&klass->lock);
-# define UNLOCK_CLASS(obj, klass) g_rec_mutex_unlock(&klass->lock);
-#else
-# define LOCK_SINK(sink)          GST_LOG_OBJECT(sink, "SINK   LOCK"); g_rec_mutex_lock(&sink->lock); GST_LOG_OBJECT(sink, "SINK LOCKED");
-# define UNLOCK_SINK(sink)        g_rec_mutex_unlock(&sink->lock); GST_LOG_OBJECT(sink, "SINK UNLOCKED");
-# define LOCK_CLASS(obj, klass)   GST_LOG_OBJECT(obj, "CLASS   LOCK"); g_rec_mutex_lock(&klass->lock); GST_LOG_OBJECT(obj, "CLASS LOCKED");
-# define UNLOCK_CLASS(obj, klass) g_rec_mutex_unlock(&klass->lock); GST_LOG_OBJECT(obj, "CLASS UNLOCKED");
-#endif
+#define LOCK_SINK(sink) G_STMT_START { \
+    GST_TRACE_OBJECT(sink, "Locking sink from thread %p", g_thread_self()); \
+    g_rec_mutex_lock(&sink->lock); \
+    GST_TRACE_OBJECT(sink, "Locked sink from thread %p", g_thread_self()); \
+} G_STMT_END
+#define UNLOCK_SINK(sink) G_STMT_START { \
+  GST_TRACE_OBJECT(sink, "Unlocking sink from thread %p", g_thread_self()); \
+  g_rec_mutex_unlock(&sink->lock); \
+} G_STMT_END
+#define LOCK_CLASS(obj, klass) G_STMT_START { \
+    GST_TRACE_OBJECT(obj, "Locking class from thread %p", g_thread_self()); \
+    g_rec_mutex_lock(&klass->lock); \
+    GST_TRACE_OBJECT(obj, "Locked class from thread %p", g_thread_self()); \
+} G_STMT_END
+#define UNLOCK_CLASS(obj, klass) G_STMT_START { \
+  GST_TRACE_OBJECT(obj, "Unlocking class from thread %p", g_thread_self()); \
+  g_rec_mutex_unlock(&klass->lock); \
+} G_STMT_END
 
 GType    gst_d3dvideosink_get_type (void);