mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 00:01:23 +00:00
tracer: add element-change-state-pre/post hook
Helps catching when a state change is starting and ending. It is also possible to track the end of state changes by checking the async-done or state-change messages. This is particularly important for elements that do async state changes.
This commit is contained in:
parent
b09e9592ec
commit
82c1ec4931
3 changed files with 26 additions and 3 deletions
|
@ -2620,12 +2620,16 @@ gst_element_change_state (GstElement * element, GstStateChange transition)
|
|||
|
||||
oclass = GST_ELEMENT_GET_CLASS (element);
|
||||
|
||||
GST_TRACER_ELEMENT_CHANGE_STATE_PRE (element, transition);
|
||||
|
||||
/* call the state change function so it can set the state */
|
||||
if (oclass->change_state)
|
||||
ret = (oclass->change_state) (element, transition);
|
||||
else
|
||||
ret = GST_STATE_CHANGE_FAILURE;
|
||||
|
||||
GST_TRACER_ELEMENT_CHANGE_STATE_POST (element, transition, ret);
|
||||
|
||||
switch (ret) {
|
||||
case GST_STATE_CHANGE_FAILURE:
|
||||
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
||||
|
|
|
@ -49,9 +49,10 @@ static const gchar *_quark_strings[] = {
|
|||
"pad-push-event-post", "pad-query-pre", "pad-query-post",
|
||||
"element-post-message-pre",
|
||||
"element-post-message-post", "element-query-pre", "element-query-post",
|
||||
"element-new", "element-add-pad", "element-remove-pad", "bin-add-pre",
|
||||
"bin-add-post", "bin-remove-pre", "bin-remove-post", "pad-link-pre",
|
||||
"pad-link-post", "pad-unlink-pre", "pad-unlink-post"
|
||||
"element-new", "element-add-pad", "element-remove-pad",
|
||||
"bin-add-pre", "bin-add-post", "bin-remove-pre", "bin-remove-post",
|
||||
"pad-link-pre", "pad-link-post", "pad-unlink-pre", "pad-unlink-post",
|
||||
"element-change-state-pre", "element-change-state-post"
|
||||
};
|
||||
|
||||
GQuark _priv_gst_tracer_quark_table[GST_TRACER_QUARK_MAX];
|
||||
|
|
|
@ -68,6 +68,8 @@ typedef enum /*< skip >*/
|
|||
GST_TRACER_QUARK_HOOK_PAD_LINK_POST,
|
||||
GST_TRACER_QUARK_HOOK_PAD_UNLINK_PRE,
|
||||
GST_TRACER_QUARK_HOOK_PAD_UNLINK_POST,
|
||||
GST_TRACER_QUARK_HOOK_ELEMENT_CHANGE_STATE_PRE,
|
||||
GST_TRACER_QUARK_HOOK_ELEMENT_CHANGE_STATE_POST,
|
||||
GST_TRACER_QUARK_MAX
|
||||
} GstTracerQuarkId;
|
||||
|
||||
|
@ -231,6 +233,20 @@ typedef void (*GstTracerHookElementRemovePad) (GObject *, GstClockTime,
|
|||
GstTracerHookElementRemovePad, (GST_TRACER_ARGS, element, pad)); \
|
||||
}G_STMT_END
|
||||
|
||||
typedef void (*GstTracerHookElementChangeStatePre) (GObject *, GstClockTime,
|
||||
GstElement *, GstStateChange);
|
||||
#define GST_TRACER_ELEMENT_CHANGE_STATE_PRE(element, transition) G_STMT_START{ \
|
||||
GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_CHANGE_STATE_PRE), \
|
||||
GstTracerHookElementChangeStatePre, (GST_TRACER_ARGS, element, transition)); \
|
||||
}G_STMT_END
|
||||
|
||||
typedef void (*GstTracerHookElementChangeStatePost) (GObject *, GstClockTime,
|
||||
GstElement *, GstStateChange, GstStateChangeReturn);
|
||||
#define GST_TRACER_ELEMENT_CHANGE_STATE_POST(element, transition, result) G_STMT_START{ \
|
||||
GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_CHANGE_STATE_POST), \
|
||||
GstTracerHookElementChangeStatePost, (GST_TRACER_ARGS, element, transition, result)); \
|
||||
}G_STMT_END
|
||||
|
||||
typedef void (*GstTracerHookBinAddPre) (GObject *, GstClockTime,
|
||||
GstBin *, GstElement *);
|
||||
#define GST_TRACER_BIN_ADD_PRE(bin, element) G_STMT_START{ \
|
||||
|
@ -306,6 +322,8 @@ typedef void (*GstTracerHookPadUnlinkPost) (GObject *, GstClockTime,
|
|||
#define GST_TRACER_ELEMENT_NEW(element)
|
||||
#define GST_TRACER_ELEMENT_ADD_PAD(element, pad)
|
||||
#define GST_TRACER_ELEMENT_REMOVE_PAD(element, pad)
|
||||
#define GST_TRACER_ELEMENT_CHANGE_STATE_PRE(element, transition)
|
||||
#define GST_TRACER_ELEMENT_CHANGE_STATE_POST(element, transition, res)
|
||||
#define GST_TRACER_BIN_ADD_PRE(bin, element)
|
||||
#define GST_TRACER_BIN_ADD_POST(bin, element, res)
|
||||
#define GST_TRACER_BIN_REMOVE_PRE(bin, element)
|
||||
|
|
Loading…
Reference in a new issue