pad-monitor: Fix locking issues

We were taking locks twice.

Also add debugging info when taking/releasing locks to help further similar issues
This commit is contained in:
Edward Hervey 2013-08-16 14:23:05 +02:00
parent f3bd5ac0c0
commit 5a659f205d
2 changed files with 15 additions and 10 deletions

View file

@ -43,8 +43,21 @@ G_BEGIN_DECLS
#define GST_VALIDATE_MONITOR_GET_OBJECT(m) (GST_VALIDATE_MONITOR_CAST (m)->target)
#define GST_VALIDATE_MONITOR_GET_RUNNER(m) (gst_validate_reporter_get_runner (GST_VALIDATE_REPORTER_CAST (m)))
#define GST_VALIDATE_MONITOR_GET_PARENT(m) (GST_VALIDATE_MONITOR_CAST (m)->parent)
#define GST_VALIDATE_MONITOR_LOCK(m) (g_mutex_lock (&GST_VALIDATE_MONITOR_CAST(m)->mutex))
#define GST_VALIDATE_MONITOR_UNLOCK(m) (g_mutex_unlock (&GST_VALIDATE_MONITOR_CAST(m)->mutex))
#define GST_VALIDATE_MONITOR_LOCK(m) \
G_STMT_START { \
GST_LOG_OBJECT (m, "About to lock %p", &GST_VALIDATE_MONITOR_CAST(m)->mutex); \
(g_mutex_lock (&GST_VALIDATE_MONITOR_CAST(m)->mutex)); \
GST_LOG_OBJECT (m, "Acquired lock %p", &GST_VALIDATE_MONITOR_CAST(m)->mutex); \
} G_STMT_END
#define GST_VALIDATE_MONITOR_UNLOCK(m) \
G_STMT_START { \
GST_LOG_OBJECT (m, "About to unlock %p", &GST_VALIDATE_MONITOR_CAST(m)->mutex); \
(g_mutex_unlock (&GST_VALIDATE_MONITOR_CAST(m)->mutex)); \
GST_LOG_OBJECT (m, "unlocked %p", &GST_VALIDATE_MONITOR_CAST(m)->mutex); \
} G_STMT_END
#define GST_VALIDATE_MONITOR_OVERRIDES_LOCK(m) g_mutex_lock (&GST_VALIDATE_MONITOR_CAST (m)->overrides_mutex)
#define GST_VALIDATE_MONITOR_OVERRIDES_UNLOCK(m) g_mutex_unlock (&GST_VALIDATE_MONITOR_CAST (m)->overrides_mutex)
#define GST_VALIDATE_MONITOR_OVERRIDES(m) (GST_VALIDATE_MONITOR_CAST (m)->overrides)

View file

@ -1540,9 +1540,6 @@ gst_validate_pad_monitor_setcaps_pre (GstValidatePadMonitor * pad_monitor,
{
GstStructure *structure;
GST_VALIDATE_PAD_MONITOR_PARENT_LOCK (pad_monitor);
GST_VALIDATE_MONITOR_LOCK (pad_monitor);
gst_validate_pad_monitor_check_caps_complete (pad_monitor, caps);
if (caps) {
@ -1597,9 +1594,6 @@ gst_validate_pad_monitor_setcaps_pre (GstValidatePadMonitor * pad_monitor,
pad_monitor->pending_setcaps_fields =
gst_structure_new_empty (PENDING_FIELDS);
GST_VALIDATE_MONITOR_UNLOCK (pad_monitor);
GST_VALIDATE_PAD_MONITOR_PARENT_UNLOCK (pad_monitor);
gst_validate_pad_monitor_setcaps_overrides (pad_monitor, caps);
}
@ -1607,10 +1601,8 @@ static void
gst_validate_pad_monitor_setcaps_post (GstValidatePadMonitor * pad_monitor,
GstCaps * caps, gboolean ret)
{
GST_VALIDATE_PAD_MONITOR_PARENT_LOCK (pad_monitor);
if (!ret)
gst_validate_pad_monitor_otherpad_clear_pending_fields (pad_monitor);
GST_VALIDATE_PAD_MONITOR_PARENT_UNLOCK (pad_monitor);
}
static gboolean