scenario: Fallback to using media_info to determine stream duration

In the case the query duration return CLOCK_TIME_NONE.
This commit is contained in:
Thibault Saunier 2017-06-05 11:35:43 -04:00
parent 37de89e6db
commit 8d251f12d9

View file

@ -432,6 +432,7 @@ _find_action_type (const gchar * type_name)
static gboolean
_set_variable_func (const gchar * name, double *value, gpointer user_data)
{
gboolean res;
GstValidateScenario *scenario = GST_VALIDATE_SCENARIO (user_data);
GstElement *pipeline = gst_validate_scenario_get_pipeline (scenario);
@ -444,7 +445,9 @@ _set_variable_func (const gchar * name, double *value, gpointer user_data)
if (!g_strcmp0 (name, "duration")) {
gint64 duration;
if (!gst_element_query_duration (pipeline, GST_FORMAT_TIME, &duration)) {
if (!(res =
gst_element_query_duration (pipeline, GST_FORMAT_TIME, &duration))
|| !GST_CLOCK_TIME_IS_VALID (duration)) {
GstValidateMonitor *monitor =
(GstValidateMonitor *) (g_object_get_data ((GObject *)
pipeline, "validate-monitor"));
@ -456,7 +459,8 @@ _set_variable_func (const gchar * name, double *value, gpointer user_data)
(monitor->media_descriptor);
else {
GST_ERROR_OBJECT (scenario, "Media-info not set");
goto fail;
if (!res)
goto fail;
}
}