From bebcb748019f96390265586174a1581fa178b8ad Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 23 Jan 2024 15:28:50 +0100 Subject: [PATCH] core: pad: call tracer query-post hook after probes Tracers are likely interested about the end result of the query, so after probes have been caled. Fix a bug where the buffer-lateness tracer was reporting a wrong latency when pad probes increased the latency. Also call the tracer hook if the pad has no query function. Fix https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/486 Part-of: --- subprojects/gstreamer/gst/gstpad.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/subprojects/gstreamer/gst/gstpad.c b/subprojects/gstreamer/gst/gstpad.c index 16d834f0fd..662db5c68b 100644 --- a/subprojects/gstreamer/gst/gstpad.c +++ b/subprojects/gstreamer/gst/gstpad.c @@ -4184,7 +4184,7 @@ gboolean gst_pad_query (GstPad * pad, GstQuery * query) { GstObject *parent; - gboolean res, serialized; + gboolean res = FALSE, serialized; GstPadQueryFunction func; GstPadProbeType type; GstFlowReturn ret; @@ -4228,7 +4228,6 @@ gst_pad_query (GstPad * pad, GstQuery * query) GST_DEBUG_OBJECT (pad, "sent query %p (%s), result %d", query, GST_QUERY_TYPE_NAME (query), res); - GST_TRACER_PAD_QUERY_POST (pad, query, res); if (res != TRUE) goto query_failed; @@ -4237,6 +4236,8 @@ gst_pad_query (GstPad * pad, GstQuery * query) PROBE_PUSH (pad, type | GST_PAD_PROBE_TYPE_PULL, query, probe_stopped); GST_OBJECT_UNLOCK (pad); + GST_TRACER_PAD_QUERY_POST (pad, query, res); + if (G_UNLIKELY (serialized)) GST_PAD_STREAM_UNLOCK (pad); @@ -4258,6 +4259,7 @@ no_parent: { GST_DEBUG_OBJECT (pad, "had no parent"); GST_OBJECT_UNLOCK (pad); + GST_TRACER_PAD_QUERY_POST (pad, query, res); if (G_UNLIKELY (serialized)) GST_PAD_STREAM_UNLOCK (pad); return FALSE; @@ -4266,6 +4268,7 @@ no_func: { GST_DEBUG_OBJECT (pad, "had no query function"); RELEASE_PARENT (parent); + GST_TRACER_PAD_QUERY_POST (pad, query, res); if (G_UNLIKELY (serialized)) GST_PAD_STREAM_UNLOCK (pad); return FALSE; @@ -4273,6 +4276,7 @@ no_func: query_failed: { GST_DEBUG_OBJECT (pad, "query failed"); + GST_TRACER_PAD_QUERY_POST (pad, query, res); if (G_UNLIKELY (serialized)) GST_PAD_STREAM_UNLOCK (pad); return FALSE; @@ -4281,6 +4285,7 @@ probe_stopped: { GST_DEBUG_OBJECT (pad, "probe stopped: %s", gst_flow_get_name (ret)); GST_OBJECT_UNLOCK (pad); + GST_TRACER_PAD_QUERY_POST (pad, query, res); if (G_UNLIKELY (serialized)) GST_PAD_STREAM_UNLOCK (pad);