From 1e1797ee3a0ed752c1d73a5aaf3580d72b14322b Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Sun, 23 Jun 2019 12:46:37 -0400 Subject: [PATCH] validate: Also monitor ghost pads Allowing overrides to work on ghost pads too --- .../gst/validate/gst-validate-bin-monitor.c | 2 +- .../validate/gst-validate-element-monitor.c | 3 +- .../gst/validate/gst-validate-pad-monitor.c | 35 ++++++++++++------- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/validate/gst/validate/gst-validate-bin-monitor.c b/validate/gst/validate/gst-validate-bin-monitor.c index c3af16643f..ae6ad46744 100644 --- a/validate/gst/validate/gst-validate-bin-monitor.c +++ b/validate/gst/validate/gst-validate-bin-monitor.c @@ -285,7 +285,7 @@ gst_validate_bin_monitor_setup (GstValidateMonitor * monitor) gst_iterator_free (iterator); gst_object_unref (bin); - return TRUE; + return GST_VALIDATE_MONITOR_CLASS (parent_class)->setup (monitor); fail: if (bin) diff --git a/validate/gst/validate/gst-validate-element-monitor.c b/validate/gst/validate/gst-validate-element-monitor.c index 20c7171b52..b8f9e6f4cc 100644 --- a/validate/gst/validate/gst-validate-element-monitor.c +++ b/validate/gst/validate/gst-validate-element-monitor.c @@ -278,7 +278,8 @@ gst_validate_element_monitor_do_setup (GstValidateMonitor * monitor) return FALSE; } - gst_validate_element_monitor_inspect (elem_monitor); + if (!GST_IS_BIN (element)) + gst_validate_element_monitor_inspect (elem_monitor); elem_monitor->pad_added_id = g_signal_connect (element, "pad-added", G_CALLBACK (_validate_element_pad_added), monitor); diff --git a/validate/gst/validate/gst-validate-pad-monitor.c b/validate/gst/validate/gst-validate-pad-monitor.c index a472ab8331..082f8bb71d 100644 --- a/validate/gst/validate/gst-validate-pad-monitor.c +++ b/validate/gst/validate/gst-validate-pad-monitor.c @@ -129,21 +129,25 @@ typedef struct static GstPad * _get_actual_pad (GstPad * pad) { - GstPad *tmp_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); - } + pad = gst_object_ref (pad); while (GST_IS_PROXY_PAD (pad)) { - tmp_pad = pad; - pad = gst_pad_get_peer (pad); - gst_object_unref (tmp_pad); + GstPad *next_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; @@ -1184,6 +1188,9 @@ static void GST_DEBUG_OBJECT (pad, "Checking pad %s:%s input timestamps", GST_DEBUG_PAD_NAME (otherpad)); othermonitor = _GET_PAD_MONITOR (otherpad); + if (!othermonitor) + continue; + GST_VALIDATE_MONITOR_LOCK (othermonitor); if (gst_validate_pad_monitor_timestamp_is_in_received_range (othermonitor, ts, tolerance) @@ -1633,6 +1640,8 @@ gst_validate_pad_monitor_add_expected_newsegment (GstValidatePadMonitor * if (!otherpad) continue; othermonitor = _GET_PAD_MONITOR (otherpad); + if (!othermonitor) + continue; GST_VALIDATE_MONITOR_LOCK (othermonitor); gst_event_replace (&othermonitor->expected_segment, event); GST_VALIDATE_MONITOR_UNLOCK (othermonitor);