mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-30 04:00:37 +00:00
validate: Add the notion of WAIT_MULTIPLIER for the wait action
Allowing the user to decide to wait more, or less, or even not wait for the wait action to execute when running scenarios.
This commit is contained in:
parent
1c2c0e63c2
commit
8c6803c467
2 changed files with 36 additions and 2 deletions
|
@ -102,5 +102,15 @@
|
|||
</para>
|
||||
</formalpara>
|
||||
|
||||
<formalpara id="GST-VALIDATE-WAIT-MULTIPLIER">
|
||||
<title><envar>GST_VALIDATE_SCENARIO_WAIT_MULITPLIER</envar></title>
|
||||
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <gst/gst.h>
|
||||
#include <gio/gio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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;
|
||||
|
|
Loading…
Reference in a new issue