From 3715b0b7b882a49761a46d2c5944765e9bf1085d Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 12 Aug 2025 11:10:55 -0400 Subject: [PATCH] debugutils: Use SHOW_FULL_PARAMS when GstDotsTracer is active When the dots tracer is detected among active tracers, switch from SHOW_ALL to SHOW_FULL_PARAMS to prevent parameter ellipsization. The dots tracer is designed to work with gst-dots-viewer which can handle long parameter values, so we preserve the full text in dot files. This improves the viewing experience when using the dots tracer with the gst-dots-viewer tool. Part-of: --- subprojects/gstreamer/gst/gstdebugutils.c | 32 ++++++++++++++++++++++ subprojects/gstreamer/gst/gsttracerutils.c | 4 +-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/subprojects/gstreamer/gst/gstdebugutils.c b/subprojects/gstreamer/gst/gstdebugutils.c index e68992764b..f20688f1a3 100644 --- a/subprojects/gstreamer/gst/gstdebugutils.c +++ b/subprojects/gstreamer/gst/gstdebugutils.c @@ -120,6 +120,38 @@ debug_dump_get_object_params (GObject * object, gchar *tmp, *value_str; const gchar *ellipses; + if (details == GST_DEBUG_GRAPH_SHOW_ALL) { + static gsize dots_tracer_enabled = 0; + + if (g_once_init_enter (&dots_tracer_enabled)) { + GList *tracers, *tmp; + gsize enabled = 1; /* 1 = not enabled, 2 = enabled */ + + tracers = gst_tracing_get_active_tracers (); + + for (tmp = tracers; tmp; tmp = tmp->next) { + GObject *tracer = G_OBJECT (tmp->data); + const gchar *type_name = G_OBJECT_TYPE_NAME (tracer); + + if (g_strcmp0 (type_name, "GstDotsTracer") == 0) { + enabled = 2; + break; + } + } + + g_list_free_full (tracers, gst_object_unref); + g_once_init_leave (&dots_tracer_enabled, enabled); + } + + /* If dots tracer is enabled, use SHOW_FULL_PARAMS instead of SHOW_ALL. + * The dots tracer is meant to be used with gst-dots-viewer which will + * ellipsize long lines for us, so we should always keep the full text + * in the dot files in that case. */ + if (dots_tracer_enabled == 2) { + details = GST_DEBUG_GRAPH_SHOW_FULL_PARAMS; + } + } + /* get paramspecs and show non-default properties */ properties = g_object_class_list_properties (G_OBJECT_GET_CLASS (object), diff --git a/subprojects/gstreamer/gst/gsttracerutils.c b/subprojects/gstreamer/gst/gsttracerutils.c index 394c2b421a..45bf70c98c 100644 --- a/subprojects/gstreamer/gst/gsttracerutils.c +++ b/subprojects/gstreamer/gst/gsttracerutils.c @@ -286,9 +286,9 @@ _priv_gst_tracing_init (void) _priv_tracers = g_hash_table_new (NULL, NULL); - if (G_N_ELEMENTS (_quark_strings) + 1 != GST_TRACER_QUARK_MAX) + if (G_N_ELEMENTS (_quark_strings) != GST_TRACER_QUARK_MAX + 1) g_warning ("the quark table is not consistent! %d != %d", - (gint) G_N_ELEMENTS (_quark_strings), GST_TRACER_QUARK_MAX); + (gint) G_N_ELEMENTS (_quark_strings), GST_TRACER_QUARK_MAX + 1); for (i = 0; i <= GST_TRACER_QUARK_MAX; i++) { _priv_gst_tracer_quark_table[i] =