From e8ef562d01240359c47c6e7e532ce63a6176ac77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alicia=20Boya=20Garc=C3=ADa?= Date: Mon, 20 Jan 2025 18:48:11 +0100 Subject: [PATCH] tracers: log: Log buffer-chain Commit de30de865cd added a hook for pad-chain-{pre,post} and pad-chain-list-{pre,post}. As explained in that commit, hooking the chain is helpful because it allows you to hook to buffer propagation in both srcpads (pad-push) and sinkpads (pad-chain). This patch uses the new hooks to log pad-chain in the log tracer. Before, only pad-push was logged, so you could only follow the flow of buffers through the srcpads. Part-of: --- .../gstreamer/plugins/tracers/gstlog.c | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/subprojects/gstreamer/plugins/tracers/gstlog.c b/subprojects/gstreamer/plugins/tracers/gstlog.c index bd89ea8be8..a36102f004 100644 --- a/subprojects/gstreamer/plugins/tracers/gstlog.c +++ b/subprojects/gstreamer/plugins/tracers/gstlog.c @@ -51,9 +51,11 @@ * * * `GST_DEBUG=GST_BUFFER:TRACE` * * `pad-push-pre`, `pad-push-post` + * * `pad-chain-pre`, `pad-chain-post` * * `pad-pull-range-pre`, `pad-pull-range-post` * * `GST_DEBUG=GST_BUFFER_LIST:TRACE` * * `pad-push-list-pre`, `pad-push-list-post` + * * `pad-chain-list-pre`, `pad-chain-list-post` * * `GST_DEBUG=GST_EVENT:TRACE` * * `pad-push-event-pre`, `pad-push-event-post` * * `GST_DEBUG=GST_QUERY:TRACE` @@ -188,6 +190,42 @@ do_push_buffer_list_post (GstTracer * self, guint64 ts, GstPad * pad, GST_TIME_ARGS (ts), pad, res); } +static void +do_chain_buffer_pre (GstTracer * self, guint64 ts, GstPad * pad, + GstFlowReturn res) +{ + do_log (GST_CAT_BUFFER, GST_FUNCTION, (GObject *) pad, + "%" GST_TIME_FORMAT ", pad=%" GST_PTR_FORMAT ", res=%d", + GST_TIME_ARGS (ts), pad, res); +} + +static void +do_chain_buffer_post (GstTracer * self, guint64 ts, GstPad * pad, + GstFlowReturn res) +{ + do_log (GST_CAT_BUFFER, GST_FUNCTION, (GObject *) pad, + "%" GST_TIME_FORMAT ", pad=%" GST_PTR_FORMAT ", res=%d", + GST_TIME_ARGS (ts), pad, res); +} + +static void +do_chain_buffer_list_pre (GstTracer * self, guint64 ts, GstPad * pad, + GstFlowReturn res) +{ + do_log (GST_CAT_BUFFER_LIST, GST_FUNCTION, (GObject *) pad, + "%" GST_TIME_FORMAT ", pad=%" GST_PTR_FORMAT ", res=%d", + GST_TIME_ARGS (ts), pad, res); +} + +static void +do_chain_buffer_list_post (GstTracer * self, guint64 ts, GstPad * pad, + GstFlowReturn res) +{ + do_log (GST_CAT_BUFFER_LIST, GST_FUNCTION, (GObject *) pad, + "%" GST_TIME_FORMAT ", pad=%" GST_PTR_FORMAT ", res=%d", + GST_TIME_ARGS (ts), pad, res); +} + static void do_pull_range_pre (GstTracer * self, guint64 ts, GstPad * pad, guint64 offset, guint size) @@ -437,6 +475,14 @@ gst_log_tracer_init (GstLogTracer * self) G_CALLBACK (do_push_buffer_list_pre)); gst_tracing_register_hook (tracer, "pad-push-list-post", G_CALLBACK (do_push_buffer_list_post)); + gst_tracing_register_hook (tracer, "pad-chain-pre", + G_CALLBACK (do_chain_buffer_pre)); + gst_tracing_register_hook (tracer, "pad-chain-post", + G_CALLBACK (do_chain_buffer_post)); + gst_tracing_register_hook (tracer, "pad-chain-list-pre", + G_CALLBACK (do_chain_buffer_list_pre)); + gst_tracing_register_hook (tracer, "pad-chain-list-post", + G_CALLBACK (do_chain_buffer_list_post)); gst_tracing_register_hook (tracer, "pad-pull-range-pre", G_CALLBACK (do_pull_range_pre)); gst_tracing_register_hook (tracer, "pad-pull-range-post",