validate: Also monitor ghost pads

Allowing overrides to work on ghost pads too
This commit is contained in:
Thibault Saunier 2019-06-23 12:46:37 -04:00
parent 25a7173b22
commit 1e1797ee3a
3 changed files with 25 additions and 15 deletions

View file

@ -285,7 +285,7 @@ gst_validate_bin_monitor_setup (GstValidateMonitor * monitor)
gst_iterator_free (iterator); gst_iterator_free (iterator);
gst_object_unref (bin); gst_object_unref (bin);
return TRUE; return GST_VALIDATE_MONITOR_CLASS (parent_class)->setup (monitor);
fail: fail:
if (bin) if (bin)

View file

@ -278,6 +278,7 @@ gst_validate_element_monitor_do_setup (GstValidateMonitor * monitor)
return FALSE; return FALSE;
} }
if (!GST_IS_BIN (element))
gst_validate_element_monitor_inspect (elem_monitor); gst_validate_element_monitor_inspect (elem_monitor);
elem_monitor->pad_added_id = g_signal_connect (element, "pad-added", elem_monitor->pad_added_id = g_signal_connect (element, "pad-added",

View file

@ -129,21 +129,25 @@ typedef struct
static GstPad * static GstPad *
_get_actual_pad (GstPad * pad) _get_actual_pad (GstPad * pad)
{ {
GstPad *tmp_pad; pad = gst_object_ref (pad);
gst_object_ref (pad);
/* We don't monitor ghost pads */
while (GST_IS_GHOST_PAD (pad)) {
tmp_pad = pad;
pad = gst_ghost_pad_get_target ((GstGhostPad *) pad);
gst_object_unref (tmp_pad);
}
while (GST_IS_PROXY_PAD (pad)) { while (GST_IS_PROXY_PAD (pad)) {
tmp_pad = pad; GstPad *next_pad;
pad = gst_pad_get_peer (pad);
gst_object_unref (tmp_pad); if (GST_PAD_IS_SINK (pad)) {
if (GST_IS_GHOST_PAD (pad))
next_pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
else
next_pad = GST_PAD (gst_proxy_pad_get_internal (GST_PROXY_PAD (pad)));
} else {
next_pad = gst_pad_get_peer (pad);
}
gst_object_unref (pad);
if (!next_pad)
return NULL;
pad = next_pad;
} }
return pad; return pad;
@ -1184,6 +1188,9 @@ static void
GST_DEBUG_OBJECT (pad, "Checking pad %s:%s input timestamps", GST_DEBUG_OBJECT (pad, "Checking pad %s:%s input timestamps",
GST_DEBUG_PAD_NAME (otherpad)); GST_DEBUG_PAD_NAME (otherpad));
othermonitor = _GET_PAD_MONITOR (otherpad); othermonitor = _GET_PAD_MONITOR (otherpad);
if (!othermonitor)
continue;
GST_VALIDATE_MONITOR_LOCK (othermonitor); GST_VALIDATE_MONITOR_LOCK (othermonitor);
if (gst_validate_pad_monitor_timestamp_is_in_received_range if (gst_validate_pad_monitor_timestamp_is_in_received_range
(othermonitor, ts, tolerance) (othermonitor, ts, tolerance)
@ -1633,6 +1640,8 @@ gst_validate_pad_monitor_add_expected_newsegment (GstValidatePadMonitor *
if (!otherpad) if (!otherpad)
continue; continue;
othermonitor = _GET_PAD_MONITOR (otherpad); othermonitor = _GET_PAD_MONITOR (otherpad);
if (!othermonitor)
continue;
GST_VALIDATE_MONITOR_LOCK (othermonitor); GST_VALIDATE_MONITOR_LOCK (othermonitor);
gst_event_replace (&othermonitor->expected_segment, event); gst_event_replace (&othermonitor->expected_segment, event);
GST_VALIDATE_MONITOR_UNLOCK (othermonitor); GST_VALIDATE_MONITOR_UNLOCK (othermonitor);