diff --git a/validate/docs/validate/envvariables.xml b/validate/docs/validate/envvariables.xml index 1a64edc185..91f88fe73a 100644 --- a/validate/docs/validate/envvariables.xml +++ b/validate/docs/validate/envvariables.xml @@ -102,5 +102,15 @@ + + <envar>GST_VALIDATE_SCENARIO_WAIT_MULITPLIER</envar> + + + A decimal number to set as a multiplier for the wait actions. For example if you set + GST_VALIDATE_SCENARIO_WAIT_MULITPLIER=0.5, for a wait action that has a duration of 2.0 + the waiting time will only be of 1.0 second. If set to 0, wait action will be ignored. + + + diff --git a/validate/gst/validate/gst-validate-scenario.c b/validate/gst/validate/gst-validate-scenario.c index 6ed97d948d..fa58fdf60c 100644 --- a/validate/gst/validate/gst-validate-scenario.c +++ b/validate/gst/validate/gst-validate-scenario.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "gst-validate-internal.h" #include "gst-validate-scenario.h" @@ -936,14 +937,37 @@ _execute_wait (GstValidateScenario * scenario, GstValidateAction * action) GstValidateScenarioPrivate *priv = scenario->priv; GstClockTime duration; + gdouble wait_multiplier = 1; + const gchar *str_wait_multiplier = + g_getenv ("GST_VALIDATE_SCENARIO_WAIT_MULTIPLIER"); + + if (str_wait_multiplier) { + errno = 0; + wait_multiplier = g_ascii_strtod (str_wait_multiplier, NULL); + + if (errno) { + GST_ERROR ("Could not use the WAIT MULTIPLIER"); + + wait_multiplier = 1; + } + + if (wait_multiplier == 0) { + GST_INFO_OBJECT (scenario, "I have been told not to wait..."); + return TRUE; + } + } + if (!gst_validate_action_get_clocktime (scenario, action, "duration", &duration)) { GST_DEBUG_OBJECT (scenario, "Duration could not be parsed"); return FALSE; } - gst_validate_printf (action, "Waiting for %" GST_TIME_FORMAT "\n", - GST_TIME_ARGS (duration)); + duration *= wait_multiplier; + gst_validate_printf (action, + "Waiting for %" GST_TIME_FORMAT " (wait_multiplier: %f)\n", + GST_TIME_ARGS (duration), wait_multiplier); + if (priv->get_pos_id) { g_source_remove (priv->get_pos_id); priv->get_pos_id = 0;