From: Thibault Saunier Date: Thu, 14 Apr 2022 13:09:35 +0000 (-0400) Subject: validate: scenario: Add a 'allow-error' configuration X-Git-Tag: 1.22.0~1792 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=05225ac602ad0fb8f53f87ec9f6d5a58de131ebf;p=platform%2Fupstream%2Fgstreamer.git validate: scenario: Add a 'allow-error' configuration This new configuration allows the scenario to keep running even after receiving an "error" message on the bus. Part-of: --- diff --git a/subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c b/subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c index 3409818..4727198 100644 --- a/subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c +++ b/subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c @@ -252,6 +252,7 @@ struct _GstValidateScenarioPrivate gboolean changing_state; gboolean needs_async_done; gboolean ignore_eos; + gboolean allow_errors; GstState target_state; GList *overrides; @@ -4246,6 +4247,28 @@ handle_bus_message (MessageData * d) goto done; } + if (is_error && priv->allow_errors) { + GST_INFO_OBJECT (scenario, "Got error but ignoring it!"); + if (scenario->priv->needs_async_done || scenario->priv->changing_state) { + + if (scenario->priv->actions) { + GstValidateAction *act = + gst_validate_action_ref (scenario->priv->actions->data); + + GST_VALIDATE_REPORT_ACTION (scenario, act, + SCENARIO_ACTION_EXECUTION_ERROR, + "Error message happened while executing action"); + gst_validate_action_set_done (act); + + gst_validate_action_unref (act); + } + + scenario->priv->needs_async_done = scenario->priv->changing_state = + FALSE; + } + goto done; + } + GST_VALIDATE_SCENARIO_EOS_HANDLING_LOCK (scenario); { /* gst_validate_action_set_done() does not finish the action @@ -4488,6 +4511,8 @@ gst_validate_scenario_load_structures (GstValidateScenario * scenario, gst_structure_get_boolean (structure, "handles-states", &priv->handles_state); gst_structure_get_boolean (structure, "ignore-eos", &priv->ignore_eos); + gst_structure_get_boolean (structure, "allow-errors", + &priv->allow_errors); gst_structure_get_boolean (structure, "actions-on-idle", &priv->execute_on_idle); @@ -6608,6 +6633,15 @@ register_action_types (void) .possible_variables = NULL, .def = "false" }, + { + .name = "allow-errors", + .description = "Ignore error messages and keep executing the scenario when it happens.\n By default " + "a 'stop' action is generated one ERROR messages", + .mandatory = FALSE, + .types = "boolean", + .possible_variables = NULL, + .def = "false" + }, {NULL} }), "Scenario metadata.\nNOTE: it used to be called \"description\"", diff --git a/subprojects/gst-devtools/validate/tools/gst-validate.c b/subprojects/gst-devtools/validate/tools/gst-validate.c index 8c5cbfa..45963b5 100644 --- a/subprojects/gst-devtools/validate/tools/gst-validate.c +++ b/subprojects/gst-devtools/validate/tools/gst-validate.c @@ -87,7 +87,8 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data) GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "gst-validate.error"); - g_main_loop_quit (loop); + if (!g_getenv ("GST_VALIDATE_SCENARIO") && !is_testfile) + g_main_loop_quit (loop); break; } case GST_MESSAGE_EOS: