validate-scenario: get duration from media_info if not able to query

In case of files, which don't have duration in header, baseparse
estimates the duration only after 1.5 seconds. But Async_done event
is sent before the duration is estimated, which results in error.
If duration query fails, getting the duration from the media-info being
passed through --set-media-info. If media-info is also not set,
printing an error message and throwing error.

https://bugzilla.gnome.org/show_bug.cgi?id=752521
This commit is contained in:
Vineeth T M 2015-07-17 23:42:22 +09:00 committed by Luis de Bethencourt
parent aa6aebe41e
commit 7e91f73c76

View file

@ -349,8 +349,18 @@ _set_variable_func (const gchar * name, double *value, gpointer user_data)
if (!gst_element_query_duration (scenario->pipeline,
GST_FORMAT_TIME, &duration)) {
GST_WARNING_OBJECT (scenario, "Could not query duration");
return FALSE;
GstValidateMonitor *monitor =
(GstValidateMonitor *) (g_object_get_data ((GObject *)
scenario->pipeline, "validate-monitor"));
GST_WARNING_OBJECT (scenario,
"Could not query duration. Trying to get duration from media-info");
if (monitor && monitor->media_descriptor)
duration =
gst_media_descriptor_get_duration (monitor->media_descriptor);
else {
GST_ERROR_OBJECT (scenario, "Media-info not set");
return FALSE;
}
}
if (!GST_CLOCK_TIME_IS_VALID (duration))