From 00719fb07eccdcaaa6f54d9899a53871e0a618c7 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 20 Jun 2014 19:01:41 +0200 Subject: [PATCH] validate: Properly handle CLOCK_TIME_NONE position and duration values In the value parser. --- validate/gst/validate/gst-validate-scenario.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/validate/gst/validate/gst-validate-scenario.c b/validate/gst/validate/gst-validate-scenario.c index 7f5a065df4..3b96286ad8 100644 --- a/validate/gst/validate/gst-validate-scenario.c +++ b/validate/gst/validate/gst-validate-scenario.c @@ -168,7 +168,11 @@ _set_variable_func (const gchar * name, double *value, gpointer user_data) GST_WARNING_OBJECT (scenario, "Could not query duration"); return FALSE; } - *value = ((double) (duration / GST_SECOND)); + + if (!GST_CLOCK_TIME_IS_VALID (duration)) + *value = G_MAXDOUBLE; + else + *value = ((double) duration / GST_SECOND); return TRUE; } else if (!g_strcmp0 (name, "position")) { @@ -179,7 +183,12 @@ _set_variable_func (const gchar * name, double *value, gpointer user_data) GST_WARNING_OBJECT (scenario, "Could not query position"); return FALSE; } - *value = ((double) position / GST_SECOND); + + if (!GST_CLOCK_TIME_IS_VALID (position)) + *value = G_MAXDOUBLE; + else + *value = ((double) position / GST_SECOND); + return TRUE; }