mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
tracing: add hooks for gst_pad_chain() / gst_pad_chain_list()
This allows tracing buffers when they arrive in a pad instead of just when they are pushed out of a pad. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2682>
This commit is contained in:
parent
dfeb8198e4
commit
de30de865c
3 changed files with 147 additions and 7 deletions
|
@ -4390,6 +4390,12 @@ gst_pad_chain_data_unchecked (GstPad * pad, GstPadProbeType type, void *data)
|
||||||
GstObject *parent;
|
GstObject *parent;
|
||||||
gboolean handled = FALSE;
|
gboolean handled = FALSE;
|
||||||
|
|
||||||
|
if (type & GST_PAD_PROBE_TYPE_BUFFER_LIST) {
|
||||||
|
GST_TRACER_PAD_CHAIN_LIST_PRE (pad, data);
|
||||||
|
} else {
|
||||||
|
GST_TRACER_PAD_CHAIN_PRE (pad, data);
|
||||||
|
}
|
||||||
|
|
||||||
GST_PAD_STREAM_LOCK (pad);
|
GST_PAD_STREAM_LOCK (pad);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (pad);
|
GST_OBJECT_LOCK (pad);
|
||||||
|
@ -4469,6 +4475,13 @@ gst_pad_chain_data_unchecked (GstPad * pad, GstPadProbeType type, void *data)
|
||||||
|
|
||||||
GST_PAD_STREAM_UNLOCK (pad);
|
GST_PAD_STREAM_UNLOCK (pad);
|
||||||
|
|
||||||
|
out:
|
||||||
|
if (type & GST_PAD_PROBE_TYPE_BUFFER_LIST) {
|
||||||
|
GST_TRACER_PAD_CHAIN_LIST_POST (pad, ret);
|
||||||
|
} else {
|
||||||
|
GST_TRACER_PAD_CHAIN_POST (pad, ret);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
@ -4480,7 +4493,8 @@ flushing:
|
||||||
GST_OBJECT_UNLOCK (pad);
|
GST_OBJECT_UNLOCK (pad);
|
||||||
GST_PAD_STREAM_UNLOCK (pad);
|
GST_PAD_STREAM_UNLOCK (pad);
|
||||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (data));
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (data));
|
||||||
return GST_FLOW_FLUSHING;
|
ret = GST_FLOW_FLUSHING;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
eos:
|
eos:
|
||||||
{
|
{
|
||||||
|
@ -4489,7 +4503,8 @@ eos:
|
||||||
GST_OBJECT_UNLOCK (pad);
|
GST_OBJECT_UNLOCK (pad);
|
||||||
GST_PAD_STREAM_UNLOCK (pad);
|
GST_PAD_STREAM_UNLOCK (pad);
|
||||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (data));
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (data));
|
||||||
return GST_FLOW_EOS;
|
ret = GST_FLOW_EOS;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
wrong_mode:
|
wrong_mode:
|
||||||
{
|
{
|
||||||
|
@ -4499,7 +4514,8 @@ wrong_mode:
|
||||||
GST_OBJECT_UNLOCK (pad);
|
GST_OBJECT_UNLOCK (pad);
|
||||||
GST_PAD_STREAM_UNLOCK (pad);
|
GST_PAD_STREAM_UNLOCK (pad);
|
||||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (data));
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (data));
|
||||||
return GST_FLOW_ERROR;
|
ret = GST_FLOW_ERROR;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
probe_handled:
|
probe_handled:
|
||||||
handled = TRUE;
|
handled = TRUE;
|
||||||
|
@ -4523,7 +4539,7 @@ probe_stopped:
|
||||||
pad->ABI.abi.last_flowret = ret;
|
pad->ABI.abi.last_flowret = ret;
|
||||||
GST_OBJECT_UNLOCK (pad);
|
GST_OBJECT_UNLOCK (pad);
|
||||||
GST_PAD_STREAM_UNLOCK (pad);
|
GST_PAD_STREAM_UNLOCK (pad);
|
||||||
return ret;
|
goto out;
|
||||||
}
|
}
|
||||||
no_parent:
|
no_parent:
|
||||||
{
|
{
|
||||||
|
@ -4532,7 +4548,8 @@ no_parent:
|
||||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (data));
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (data));
|
||||||
GST_OBJECT_UNLOCK (pad);
|
GST_OBJECT_UNLOCK (pad);
|
||||||
GST_PAD_STREAM_UNLOCK (pad);
|
GST_PAD_STREAM_UNLOCK (pad);
|
||||||
return GST_FLOW_FLUSHING;
|
ret = GST_FLOW_FLUSHING;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
no_function:
|
no_function:
|
||||||
{
|
{
|
||||||
|
@ -4542,7 +4559,8 @@ no_function:
|
||||||
g_critical ("chain on pad %s:%s but it has no chainfunction",
|
g_critical ("chain on pad %s:%s but it has no chainfunction",
|
||||||
GST_DEBUG_PAD_NAME (pad));
|
GST_DEBUG_PAD_NAME (pad));
|
||||||
GST_PAD_STREAM_UNLOCK (pad);
|
GST_PAD_STREAM_UNLOCK (pad);
|
||||||
return GST_FLOW_NOT_SUPPORTED;
|
ret = GST_FLOW_NOT_SUPPORTED;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,9 @@ static const gchar *_quark_strings[] = {
|
||||||
"element-change-state-pre", "element-change-state-post",
|
"element-change-state-pre", "element-change-state-post",
|
||||||
"mini-object-created", "mini-object-destroyed", "object-created",
|
"mini-object-created", "mini-object-destroyed", "object-created",
|
||||||
"object-destroyed", "mini-object-reffed", "mini-object-unreffed",
|
"object-destroyed", "mini-object-reffed", "mini-object-unreffed",
|
||||||
"object-reffed", "object-unreffed", "plugin-feature-loaded"
|
"object-reffed", "object-unreffed", "plugin-feature-loaded",
|
||||||
|
"pad-chain-pre", "pad-chain-post", "pad-chain-list-pre",
|
||||||
|
"pad-chain-list-post",
|
||||||
};
|
};
|
||||||
|
|
||||||
GQuark _priv_gst_tracer_quark_table[GST_TRACER_QUARK_MAX];
|
GQuark _priv_gst_tracer_quark_table[GST_TRACER_QUARK_MAX];
|
||||||
|
|
|
@ -80,6 +80,10 @@ typedef enum /*< skip >*/
|
||||||
GST_TRACER_QUARK_HOOK_OBJECT_REFFED,
|
GST_TRACER_QUARK_HOOK_OBJECT_REFFED,
|
||||||
GST_TRACER_QUARK_HOOK_OBJECT_UNREFFED,
|
GST_TRACER_QUARK_HOOK_OBJECT_UNREFFED,
|
||||||
GST_TRACER_QUARK_HOOK_PLUGIN_FEATURE_LOADED,
|
GST_TRACER_QUARK_HOOK_PLUGIN_FEATURE_LOADED,
|
||||||
|
GST_TRACER_QUARK_HOOK_PAD_CHAIN_PRE,
|
||||||
|
GST_TRACER_QUARK_HOOK_PAD_CHAIN_POST,
|
||||||
|
GST_TRACER_QUARK_HOOK_PAD_CHAIN_LIST_PRE,
|
||||||
|
GST_TRACER_QUARK_HOOK_PAD_CHAIN_LIST_POST,
|
||||||
GST_TRACER_QUARK_MAX
|
GST_TRACER_QUARK_MAX
|
||||||
} GstTracerQuarkId;
|
} GstTracerQuarkId;
|
||||||
|
|
||||||
|
@ -722,6 +726,118 @@ typedef void (*GstTracerHookPluginFeatureLoaded) (GObject *self, GstClockTime ts
|
||||||
GstTracerHookPluginFeatureLoaded, (GST_TRACER_ARGS, feature)); \
|
GstTracerHookPluginFeatureLoaded, (GST_TRACER_ARGS, feature)); \
|
||||||
}G_STMT_END
|
}G_STMT_END
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstTracerHookPadChainPre:
|
||||||
|
* @self: the tracer instance
|
||||||
|
* @ts: the current timestamp
|
||||||
|
* @pad: the pad
|
||||||
|
* @buffer: the buffer
|
||||||
|
*
|
||||||
|
* Pre-hook for gst_pad_chain() named "pad-chain-pre".
|
||||||
|
*
|
||||||
|
* Since: 1.22
|
||||||
|
*/
|
||||||
|
typedef void (*GstTracerHookPadChainPre) (GObject *self, GstClockTime ts,
|
||||||
|
GstPad *pad, GstBuffer *buffer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GST_TRACER_PAD_CHAIN_PRE:
|
||||||
|
* @pad: a %GstPad
|
||||||
|
* @buffer: a %GstBuffer
|
||||||
|
*
|
||||||
|
* Dispatches the "pad-chain-pre" hook.
|
||||||
|
*
|
||||||
|
* Since: 1.22
|
||||||
|
*/
|
||||||
|
#define GST_TRACER_PAD_CHAIN_PRE(pad, buffer) G_STMT_START{ \
|
||||||
|
GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_CHAIN_PRE), \
|
||||||
|
GstTracerHookPadChainPre, (GST_TRACER_ARGS, pad, buffer)); \
|
||||||
|
}G_STMT_END
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstTracerHookPadChainPost:
|
||||||
|
* @self: the tracer instance
|
||||||
|
* @ts: the current timestamp
|
||||||
|
* @pad: the pad
|
||||||
|
* @res: the result of gst_pad_chain()
|
||||||
|
*
|
||||||
|
* Post-hook for gst_pad_chain() named "pad-chain-post".
|
||||||
|
*
|
||||||
|
* Since: 1.22
|
||||||
|
*/
|
||||||
|
typedef void (*GstTracerHookPadChainPost) (GObject * self, GstClockTime ts,
|
||||||
|
GstPad *pad, GstFlowReturn res);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GST_TRACER_PAD_CHAIN_POST:
|
||||||
|
* @pad: a %GstPad
|
||||||
|
* @res: a %GstFlowReturn
|
||||||
|
*
|
||||||
|
* Dispatches the "pad-chain-post" hook.
|
||||||
|
*
|
||||||
|
* Since: 1.22
|
||||||
|
*/
|
||||||
|
#define GST_TRACER_PAD_CHAIN_POST(pad, res) G_STMT_START{ \
|
||||||
|
GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_CHAIN_POST), \
|
||||||
|
GstTracerHookPadChainPost, (GST_TRACER_ARGS, pad, res)); \
|
||||||
|
}G_STMT_END
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstTracerHookPadChainListPre:
|
||||||
|
* @self: the tracer instance
|
||||||
|
* @ts: the current timestamp
|
||||||
|
* @pad: the pad
|
||||||
|
* @list: the buffer-list
|
||||||
|
*
|
||||||
|
* Pre-hook for gst_pad_chain_list() named "pad-chain-list-pre".
|
||||||
|
*
|
||||||
|
* Since: 1.22
|
||||||
|
*/
|
||||||
|
typedef void (*GstTracerHookPadChainListPre) (GObject *self, GstClockTime ts,
|
||||||
|
GstPad *pad, GstBufferList *list);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GST_TRACER_PAD_CHAIN_LIST_PRE:
|
||||||
|
* @pad: a %GstPad
|
||||||
|
* @list: a %GstBufferList
|
||||||
|
*
|
||||||
|
* Dispatches the "pad-chain-list-pre" hook.
|
||||||
|
*
|
||||||
|
* Since: 1.22
|
||||||
|
*/
|
||||||
|
#define GST_TRACER_PAD_CHAIN_LIST_PRE(pad, list) G_STMT_START{ \
|
||||||
|
GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_CHAIN_LIST_PRE), \
|
||||||
|
GstTracerHookPadChainListPre, (GST_TRACER_ARGS, pad, list)); \
|
||||||
|
}G_STMT_END
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstTracerHookPadChainListPost:
|
||||||
|
* @self: the tracer instance
|
||||||
|
* @ts: the current timestamp
|
||||||
|
* @pad: the pad
|
||||||
|
* @res: the result of gst_pad_chain_list()
|
||||||
|
*
|
||||||
|
* Post-hook for gst_pad_chain_list() named "pad-chain-list-post".
|
||||||
|
*
|
||||||
|
* Since: 1.22
|
||||||
|
*/
|
||||||
|
typedef void (*GstTracerHookPadChainListPost) (GObject *self, GstClockTime ts,
|
||||||
|
GstPad *pad,
|
||||||
|
GstFlowReturn res);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GST_TRACER_PAD_CHAIN_LIST_POST:
|
||||||
|
* @pad: a %GstPad
|
||||||
|
* @res: a %GstFlowReturn
|
||||||
|
*
|
||||||
|
* Dispatches the "pad-chain-list-post" hook.
|
||||||
|
*
|
||||||
|
* Since: 1.22
|
||||||
|
*/
|
||||||
|
#define GST_TRACER_PAD_CHAIN_LIST_POST(pad, res) G_STMT_START{ \
|
||||||
|
GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_CHAIN_LIST_POST), \
|
||||||
|
GstTracerHookPadChainListPost, (GST_TRACER_ARGS, pad, res)); \
|
||||||
|
}G_STMT_END
|
||||||
|
|
||||||
#else /* !GST_DISABLE_GST_TRACER_HOOKS */
|
#else /* !GST_DISABLE_GST_TRACER_HOOKS */
|
||||||
|
|
||||||
|
@ -772,6 +888,10 @@ _priv_gst_tracing_deinit (void)
|
||||||
#define GST_TRACER_OBJECT_REFFED(object, new_refcount)
|
#define GST_TRACER_OBJECT_REFFED(object, new_refcount)
|
||||||
#define GST_TRACER_OBJECT_UNREFFED(object, new_refcount)
|
#define GST_TRACER_OBJECT_UNREFFED(object, new_refcount)
|
||||||
#define GST_TRACER_PLUGIN_FEATURE_LOADED(feature)
|
#define GST_TRACER_PLUGIN_FEATURE_LOADED(feature)
|
||||||
|
#define GST_TRACER_PAD_CHAIN_PRE(pad, buffer)
|
||||||
|
#define GST_TRACER_PAD_CHAIN_POST(pad, res)
|
||||||
|
#define GST_TRACER_PAD_CHAIN_LIST_PRE(pad, list)
|
||||||
|
#define GST_TRACER_PAD_CHAIN_LIST_POST(pad, res)
|
||||||
|
|
||||||
#endif /* GST_DISABLE_GST_TRACER_HOOKS */
|
#endif /* GST_DISABLE_GST_TRACER_HOOKS */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue