mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 03:01:03 +00:00
validate: Properly handle CLOCK_TIME_NONE position and duration values
In the value parser.
This commit is contained in:
parent
3607fd8deb
commit
00719fb07e
1 changed files with 11 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue