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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5963>
This commit is contained in:
Guillaume Desmottes 2024-01-23 15:28:50 +01:00 committed by GStreamer Marge Bot
parent 73dedf9a51
commit bebcb74801

View file

@ -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);