mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-21 05:26:23 +00:00
validate: Allow doting the pipeline on issue reporting
And let the user configure on what level of issues to do it by setting the GST_VALIDATE_CONFIG env var. Always dot on critical issues.
This commit is contained in:
parent
1fb0f02d6a
commit
41b005963f
6 changed files with 99 additions and 2 deletions
|
@ -97,7 +97,7 @@
|
|||
</para>
|
||||
|
||||
<informalexample>
|
||||
For example if you want to make sure to set a property on a element of a type
|
||||
If you want to make sure to set a property on a element of a type
|
||||
(for example to disable QoS on all sinks) you can do:
|
||||
|
||||
<programlisting>
|
||||
|
@ -105,6 +105,17 @@
|
|||
</programlisting>
|
||||
</informalexample>
|
||||
|
||||
<informalexample>
|
||||
If you want the GstPipeline to get dumped when an issue of a
|
||||
certain level (and higher) happens, you can do:
|
||||
|
||||
<programlisting>
|
||||
core, action=dot-pipeline, report-level=issue
|
||||
</programlisting>
|
||||
|
||||
Note that you will still need to set <envar>GST_DEBUG_DUMP_DOT_DIR</envar>.
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
For more examples you can look at the ssim GstValidate plugin documentation to
|
||||
see how to configure that plugin.
|
||||
|
|
|
@ -31,6 +31,7 @@ GST_DEBUG_CATEGORY_EXTERN (gstvalidate_debug);
|
|||
#define GST_CAT_DEFAULT gstvalidate_debug
|
||||
|
||||
extern GRegex *newline_regex;
|
||||
extern GstClockTime _priv_start_time;
|
||||
|
||||
|
||||
/* If an action type is 1 (TRUE) we also consider it is a config to keep backward compatibility */
|
||||
|
|
|
@ -1182,6 +1182,22 @@ gst_validate_report_print_trace (GstValidateReport * report)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_validate_report_print_dotfile (GstValidateReport * report)
|
||||
{
|
||||
const gchar *dotdir = g_getenv ("GST_DEBUG_DUMP_DOT_DIR");
|
||||
|
||||
if (!report->dotfile_name)
|
||||
return;
|
||||
|
||||
if (dotdir)
|
||||
gst_validate_printf (NULL, "%*s dotfile : %s%s%s.dot\n", 12, "",
|
||||
dotdir, G_DIR_SEPARATOR_S, report->dotfile_name);
|
||||
else
|
||||
gst_validate_printf (NULL,
|
||||
"%*s dotfile : not dotfile produced as GST_DEBUG_DUMP_DOT_DIR is not set.\n",
|
||||
12, "");
|
||||
}
|
||||
|
||||
void
|
||||
gst_validate_report_print_description (GstValidateReport * report)
|
||||
|
@ -1199,6 +1215,7 @@ gst_validate_report_printf (GstValidateReport * report)
|
|||
gst_validate_report_print_level (report);
|
||||
gst_validate_report_print_detected_on (report);
|
||||
gst_validate_report_print_details (report);
|
||||
gst_validate_report_print_dotfile (report);
|
||||
gst_validate_report_print_trace (report);
|
||||
|
||||
for (tmp = report->repeated_reports; tmp; tmp = tmp->next) {
|
||||
|
|
|
@ -183,8 +183,9 @@ struct _GstValidateReport {
|
|||
GstValidateReportingDetails reporting_level;
|
||||
gchar *reporter_name;
|
||||
gchar *trace;
|
||||
gchar *dotfile_name;
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING - 1];
|
||||
gpointer _gst_reserved[GST_PADDING - 2];
|
||||
};
|
||||
|
||||
void gst_validate_report_add_message (GstValidateReport *report,
|
||||
|
|
|
@ -537,6 +537,69 @@ synthesize_reports (GstValidateRunner * runner, GstValidateReport * report)
|
|||
GST_VALIDATE_RUNNER_UNLOCK (runner);
|
||||
}
|
||||
|
||||
static void
|
||||
_dot_pipeline (GstValidateReport * report, GstStructure * config)
|
||||
{
|
||||
GstPipeline *pipeline = gst_validate_reporter_get_pipeline (report->reporter);
|
||||
|
||||
if (pipeline) {
|
||||
gint details = GST_DEBUG_GRAPH_SHOW_ALL;
|
||||
report->dotfile_name =
|
||||
g_strdup_printf ("%" GST_TIME_FORMAT "-validate-report-%s-on-%s-%s",
|
||||
GST_TIME_ARGS (GST_CLOCK_DIFF (_priv_start_time,
|
||||
gst_util_get_timestamp ())),
|
||||
gst_validate_report_level_get_name (report->level),
|
||||
gst_validate_reporter_get_name (report->reporter),
|
||||
g_quark_to_string (report->issue->issue_id));
|
||||
|
||||
if (config)
|
||||
gst_structure_get_int (config, "details", &details);
|
||||
|
||||
GST_DEBUG_BIN_TO_DOT_FILE (GST_BIN (pipeline),
|
||||
GST_DEBUG_GRAPH_SHOW_ALL, report->dotfile_name);
|
||||
|
||||
gst_object_unref (pipeline);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gst_validate_runner_maybe_dot_pipeline (GstValidateRunner * runner,
|
||||
GstValidateReport * report)
|
||||
{
|
||||
GList *config;
|
||||
|
||||
if (report->level == GST_VALIDATE_REPORT_LEVEL_CRITICAL ||
|
||||
gst_validate_report_check_abort (report)) {
|
||||
|
||||
_dot_pipeline (report, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
for (config = gst_validate_plugin_get_config (NULL);
|
||||
config; config = config->next) {
|
||||
|
||||
if (gst_structure_has_name (config->data, "core")) {
|
||||
GstValidateReportLevel level;
|
||||
const gchar *level_str,
|
||||
*action = gst_structure_get_string (config->data, "action");
|
||||
|
||||
if (g_strcmp0 (action, "dot-pipeline"))
|
||||
continue;
|
||||
|
||||
level_str = gst_structure_get_string (config->data, "report-level");
|
||||
level = level_str ? gst_validate_report_level_from_name (level_str) :
|
||||
GST_VALIDATE_REPORT_LEVEL_CRITICAL;
|
||||
|
||||
if (level >= report->level) {
|
||||
_dot_pipeline (report, config->data);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gst_validate_runner_add_report (GstValidateRunner * runner,
|
||||
GstValidateReport * report)
|
||||
|
@ -545,6 +608,7 @@ gst_validate_runner_add_report (GstValidateRunner * runner,
|
|||
|
||||
gst_validate_send (json_boxed_serialize (GST_MINI_OBJECT_TYPE (report),
|
||||
report));
|
||||
gst_validate_runner_maybe_dot_pipeline (runner, report);
|
||||
|
||||
details = reporter_details =
|
||||
gst_validate_reporter_get_reporting_level (report->reporter);
|
||||
|
|
|
@ -52,6 +52,7 @@ static GstRegistry *_gst_validate_registry_default = NULL;
|
|||
|
||||
static GList *core_config = NULL;
|
||||
static gboolean validate_initialized = FALSE;
|
||||
GstClockTime _priv_start_time;
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
|
||||
|
@ -263,6 +264,8 @@ gst_validate_init (void)
|
|||
GST_DEBUG_CATEGORY_INIT (gstvalidate_debug, "validate", 0,
|
||||
"Validation library");
|
||||
|
||||
_priv_start_time = gst_util_get_timestamp ();
|
||||
|
||||
/* init the report system (can be called multiple times) */
|
||||
gst_validate_report_init ();
|
||||
|
||||
|
|
Loading…
Reference in a new issue