mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
pads: make pad activation debug logs a bit more readable
This commit is contained in:
parent
08c2c446a5
commit
0841ac48f1
3 changed files with 42 additions and 18 deletions
|
@ -2362,7 +2362,7 @@ gst_bin_src_pads_activate (GstBin * bin, gboolean active)
|
||||||
GstIterator *iter;
|
GstIterator *iter;
|
||||||
gboolean fold_ok;
|
gboolean fold_ok;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (bin, "src_pads_activate with active %d", active);
|
GST_DEBUG_OBJECT (bin, "%s pads", active ? "activate" : "deactivate");
|
||||||
|
|
||||||
iter = gst_element_iterate_src_pads ((GstElement *) bin);
|
iter = gst_element_iterate_src_pads ((GstElement *) bin);
|
||||||
fold_ok = iterator_activate_fold_with_resync (iter, &active);
|
fold_ok = iterator_activate_fold_with_resync (iter, &active);
|
||||||
|
@ -2370,14 +2370,14 @@ gst_bin_src_pads_activate (GstBin * bin, gboolean active)
|
||||||
if (G_UNLIKELY (!fold_ok))
|
if (G_UNLIKELY (!fold_ok))
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (bin, "pads_activate successful");
|
GST_DEBUG_OBJECT (bin, "pad %sactivation successful", active ? "" : "de");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
failed:
|
failed:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (bin, "source pads_activate failed");
|
GST_DEBUG_OBJECT (bin, "pad %sactivation failed", active ? "" : "de");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2699,7 +2699,7 @@ gst_element_pads_activate (GstElement * element, gboolean active)
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
GST_CAT_DEBUG_OBJECT (GST_CAT_ELEMENT_PADS, element,
|
GST_CAT_DEBUG_OBJECT (GST_CAT_ELEMENT_PADS, element,
|
||||||
"pads_activate with active %d", active);
|
"%s pads", active ? "activate" : "deactivate");
|
||||||
|
|
||||||
iter = gst_element_iterate_src_pads (element);
|
iter = gst_element_iterate_src_pads (element);
|
||||||
res =
|
res =
|
||||||
|
@ -2718,7 +2718,7 @@ gst_element_pads_activate (GstElement * element, gboolean active)
|
||||||
goto sink_failed;
|
goto sink_failed;
|
||||||
|
|
||||||
GST_CAT_DEBUG_OBJECT (GST_CAT_ELEMENT_PADS, element,
|
GST_CAT_DEBUG_OBJECT (GST_CAT_ELEMENT_PADS, element,
|
||||||
"pads_activate successful");
|
"pad %sactivation successful", active ? "" : "de");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
@ -2726,7 +2726,7 @@ gst_element_pads_activate (GstElement * element, gboolean active)
|
||||||
src_failed:
|
src_failed:
|
||||||
{
|
{
|
||||||
GST_CAT_DEBUG_OBJECT (GST_CAT_ELEMENT_PADS, element,
|
GST_CAT_DEBUG_OBJECT (GST_CAT_ELEMENT_PADS, element,
|
||||||
"source pads_activate failed");
|
"pad %sactivation failed", active ? "" : "de");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
sink_failed:
|
sink_failed:
|
||||||
|
|
48
gst/gstpad.c
48
gst/gstpad.c
|
@ -808,6 +808,24 @@ gst_pad_activate_default (GstPad * pad, GstObject * parent)
|
||||||
return gst_pad_activate_mode (pad, GST_PAD_MODE_PUSH, TRUE);
|
return gst_pad_activate_mode (pad, GST_PAD_MODE_PUSH, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
|
static const gchar *
|
||||||
|
gst_pad_mode_get_name (GstPadMode mode)
|
||||||
|
{
|
||||||
|
switch (mode) {
|
||||||
|
case GST_PAD_MODE_NONE:
|
||||||
|
return "none";
|
||||||
|
case GST_PAD_MODE_PUSH:
|
||||||
|
return "push";
|
||||||
|
case GST_PAD_MODE_PULL:
|
||||||
|
return "pull";
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pre_activate (GstPad * pad, GstPadMode new_mode)
|
pre_activate (GstPad * pad, GstPadMode new_mode)
|
||||||
{
|
{
|
||||||
|
@ -824,7 +842,8 @@ pre_activate (GstPad * pad, GstPadMode new_mode)
|
||||||
case GST_PAD_MODE_PUSH:
|
case GST_PAD_MODE_PUSH:
|
||||||
case GST_PAD_MODE_PULL:
|
case GST_PAD_MODE_PULL:
|
||||||
GST_OBJECT_LOCK (pad);
|
GST_OBJECT_LOCK (pad);
|
||||||
GST_DEBUG_OBJECT (pad, "setting PAD_MODE %d, unset flushing", new_mode);
|
GST_DEBUG_OBJECT (pad, "setting pad into %s mode, unset flushing",
|
||||||
|
gst_pad_mode_get_name (new_mode));
|
||||||
GST_PAD_UNSET_FLUSHING (pad);
|
GST_PAD_UNSET_FLUSHING (pad);
|
||||||
GST_PAD_MODE (pad) = new_mode;
|
GST_PAD_MODE (pad) = new_mode;
|
||||||
if (GST_PAD_IS_SINK (pad)) {
|
if (GST_PAD_IS_SINK (pad)) {
|
||||||
|
@ -911,7 +930,8 @@ gst_pad_set_active (GstPad * pad, gboolean active)
|
||||||
GST_DEBUG_OBJECT (pad, "activating pad from none");
|
GST_DEBUG_OBJECT (pad, "activating pad from none");
|
||||||
ret = (GST_PAD_ACTIVATEFUNC (pad)) (pad, parent);
|
ret = (GST_PAD_ACTIVATEFUNC (pad)) (pad, parent);
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (pad, "pad was active in mode %d", old);
|
GST_DEBUG_OBJECT (pad, "pad was active in %s mode",
|
||||||
|
gst_pad_mode_get_name (old));
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -919,7 +939,8 @@ gst_pad_set_active (GstPad * pad, gboolean active)
|
||||||
GST_DEBUG_OBJECT (pad, "pad was inactive");
|
GST_DEBUG_OBJECT (pad, "pad was inactive");
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (pad, "deactivating pad from mode %d", old);
|
GST_DEBUG_OBJECT (pad, "deactivating pad from %s mode",
|
||||||
|
gst_pad_mode_get_name (old));
|
||||||
ret = gst_pad_activate_mode (pad, old, FALSE);
|
ret = gst_pad_activate_mode (pad, old, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -998,7 +1019,9 @@ gst_pad_activate_mode (GstPad * pad, GstPadMode mode, gboolean active)
|
||||||
if (active && old != mode) {
|
if (active && old != mode) {
|
||||||
/* pad was activate in the wrong direction, deactivate it
|
/* pad was activate in the wrong direction, deactivate it
|
||||||
* and reactivate it in the requested mode */
|
* and reactivate it in the requested mode */
|
||||||
GST_DEBUG_OBJECT (pad, "deactivating pad from mode %d", old);
|
GST_DEBUG_OBJECT (pad, "deactivating pad from %s mode",
|
||||||
|
gst_pad_mode_get_name (old));
|
||||||
|
|
||||||
if (G_UNLIKELY (!gst_pad_activate_mode (pad, old, FALSE)))
|
if (G_UNLIKELY (!gst_pad_activate_mode (pad, old, FALSE)))
|
||||||
goto deactivate_failed;
|
goto deactivate_failed;
|
||||||
}
|
}
|
||||||
|
@ -1044,8 +1067,8 @@ gst_pad_activate_mode (GstPad * pad, GstPadMode mode, gboolean active)
|
||||||
|
|
||||||
post_activate (pad, new);
|
post_activate (pad, new);
|
||||||
|
|
||||||
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "%s in mode %d",
|
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "%s in %s mode",
|
||||||
active ? "activated" : "deactivated", mode);
|
active ? "activated" : "deactivated", gst_pad_mode_get_name (mode));
|
||||||
|
|
||||||
exit_success:
|
exit_success:
|
||||||
res = TRUE;
|
res = TRUE;
|
||||||
|
@ -1062,15 +1085,16 @@ no_parent:
|
||||||
}
|
}
|
||||||
was_ok:
|
was_ok:
|
||||||
{
|
{
|
||||||
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "already %s in mode %d",
|
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "already %s in %s mode",
|
||||||
active ? "activated" : "deactivated", mode);
|
active ? "activated" : "deactivated", gst_pad_mode_get_name (mode));
|
||||||
goto exit_success;
|
goto exit_success;
|
||||||
}
|
}
|
||||||
deactivate_failed:
|
deactivate_failed:
|
||||||
{
|
{
|
||||||
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
|
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
|
||||||
"failed to %s in switch to mode %d from mode %d",
|
"failed to %s in switch to %s mode from %s mode",
|
||||||
(active ? "activate" : "deactivate"), mode, old);
|
(active ? "activate" : "deactivate"), gst_pad_mode_get_name (mode),
|
||||||
|
gst_pad_mode_get_name (old));
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
peer_failed:
|
peer_failed:
|
||||||
|
@ -1091,8 +1115,8 @@ not_linked:
|
||||||
failure:
|
failure:
|
||||||
{
|
{
|
||||||
GST_OBJECT_LOCK (pad);
|
GST_OBJECT_LOCK (pad);
|
||||||
GST_CAT_INFO_OBJECT (GST_CAT_PADS, pad, "failed to %s in mode %d",
|
GST_CAT_INFO_OBJECT (GST_CAT_PADS, pad, "failed to %s in %s mode",
|
||||||
active ? "activate" : "deactivate", mode);
|
active ? "activate" : "deactivate", gst_pad_mode_get_name (mode));
|
||||||
GST_PAD_SET_FLUSHING (pad);
|
GST_PAD_SET_FLUSHING (pad);
|
||||||
GST_PAD_MODE (pad) = old;
|
GST_PAD_MODE (pad) = old;
|
||||||
GST_OBJECT_UNLOCK (pad);
|
GST_OBJECT_UNLOCK (pad);
|
||||||
|
|
Loading…
Reference in a new issue