tracers: signal pad-push-event when pushing sticky events

Previously, the tracer pad-push-event was only signalled on
gst_pad_push_event().  However, the sticky event handling code in
GStreamer uses gst_pad_push_event_unchecked() instead, which meant those
events were not logged.

This patch extends the definition of the pad-push-event tracer to cover
both calls to gst_pad_push_event() and any direct calls to
gst_pad_push_event_unchecked() that skip the former inside GstPad
private code.

gst_pad_push_event_unchecked() returns GstFlowReturn instead of
gboolean like gst_pad_push_event(). To maintain API compatibility, the
GstFlowReturn is converted to gboolean.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/4182

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8342>
This commit is contained in:
Alicia Boya García 2025-01-22 18:30:07 +01:00 committed by GStreamer Marge Bot
parent fb2337ea82
commit a35bf1e384
2 changed files with 16 additions and 2 deletions

View File

@ -4100,8 +4100,10 @@ push_sticky (GstPad * pad, PadEvent * ev, gpointer user_data)
data_sticky_order < ev->sticky_order) {
data->ret = GST_FLOW_CUSTOM_SUCCESS_1;
} else {
GST_TRACER_PAD_PUSH_EVENT_PRE (pad, event);
data->ret = gst_pad_push_event_unchecked (pad, gst_event_ref (event),
GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM);
GST_TRACER_PAD_PUSH_EVENT_POST (pad, data->ret >= GST_FLOW_OK);
if (data->ret == GST_FLOW_CUSTOM_SUCCESS_1)
data->ret = GST_FLOW_OK;
}
@ -4172,8 +4174,10 @@ check_sticky (GstPad * pad, GstEvent * event)
PadEvent *ev = find_event_by_type (pad, GST_EVENT_EOS, 0);
if (ev && !ev->received) {
GST_TRACER_PAD_PUSH_EVENT_PRE (pad, event);
data.ret = gst_pad_push_event_unchecked (pad, gst_event_ref (ev->event),
GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM);
GST_TRACER_PAD_PUSH_EVENT_POST (pad, data.ret >= GST_FLOW_OK);
/* the event could have been dropped. Because this can only
* happen if the user asked for it, it's not an error */
if (data.ret == GST_FLOW_CUSTOM_SUCCESS)

View File

@ -234,7 +234,12 @@ typedef void (*GstTracerHookPadPullRangePost) (GObject *self, GstClockTime ts,
* @pad: the pad
* @event: the event
*
* Pre-hook for gst_pad_push_event() named "pad-push-event-pre".
* Pre-hook for when an event is pushed through a pad, named
* "pad-push-event-pre".
*
* Called by gst_pad_push_event(). Also called by functions other than
* gst_pad_push_event() that call gst_pad_push_event_unchecked() directly,
* namely push_sticky() and check_sticky().
*/
typedef void (*GstTracerHookPadPushEventPre) (GObject *self, GstClockTime ts,
GstPad *pad, GstEvent *event);
@ -250,7 +255,12 @@ typedef void (*GstTracerHookPadPushEventPre) (GObject *self, GstClockTime ts,
* @pad: the pad
* @res: the result of gst_pad_push_event()
*
* Post-hook for gst_pad_push_event() named "pad-push-event-post".
* Post-hook for when an event has been pushed through a pad, named
* "pad-push-event-post".
*
* Called by gst_pad_push_event(). Also called by functions other than
* gst_pad_push_event() that call gst_pad_push_event_unchecked() directly,
* namely push_sticky() and check_sticky().
*/
typedef void (*GstTracerHookPadPushEventPost) (GObject *self, GstClockTime ts,
GstPad *pad, gboolean res);