diff --git a/validate/gst/validate/gst-validate-report.c b/validate/gst/validate/gst-validate-report.c index df9c5bd843..4726f03f29 100644 --- a/validate/gst/validate/gst-validate-report.c +++ b/validate/gst/validate/gst-validate-report.c @@ -201,6 +201,9 @@ gst_validate_report_load_issues (void) REGISTER_VALIDATE_ISSUE (CRITICAL, MISSING_PLUGIN, _("a gstreamer plugin is missing and prevented Validate from running"), NULL); + REGISTER_VALIDATE_ISSUE (WARNING, QUERY_POSITION_SUPERIOR_DURATION, + _("Query position reported a value superior than what query duration " + "returned"), NULL); } void diff --git a/validate/gst/validate/gst-validate-report.h b/validate/gst/validate/gst-validate-report.h index 207f63b2a8..9a09b20625 100644 --- a/validate/gst/validate/gst-validate-report.h +++ b/validate/gst/validate/gst-validate-report.h @@ -106,6 +106,8 @@ typedef enum { #define GST_VALIDATE_ISSUE_ID_ALLOCATION_FAILURE (((GstValidateIssueId) GST_VALIDATE_AREA_RUN_ERROR) << GST_VALIDATE_ISSUE_ID_SHIFT | 1) #define GST_VALIDATE_ISSUE_ID_MISSING_PLUGIN (((GstValidateIssueId) GST_VALIDATE_AREA_RUN_ERROR) << GST_VALIDATE_ISSUE_ID_SHIFT | 2) +#define GST_VALIDATE_ISSUE_ID_QUERY_POSITION_SUPERIOR_DURATION (((GstValidateIssueId) GST_VALIDATE_AREA_QUERY) << GST_VALIDATE_ISSUE_ID_SHIFT | 1) + #define GST_VALIDATE_ISSUE_ID_AREA(id) ((guintptr)(id >> GST_VALIDATE_ISSUE_ID_SHIFT)) typedef struct { diff --git a/validate/gst/validate/gst-validate-scenario.c b/validate/gst/validate/gst-validate-scenario.c index e8232b16f6..12724fa9c9 100644 --- a/validate/gst/validate/gst-validate-scenario.c +++ b/validate/gst/validate/gst-validate-scenario.c @@ -473,10 +473,10 @@ static gboolean get_position (GstValidateScenario * scenario) { GList *tmp; - gint64 position; GstQuery *query; gdouble rate = 1.0; ScenarioAction *act; + gint64 position, duration; GstFormat format = GST_FORMAT_TIME; GstValidateScenarioPrivate *priv = scenario->priv; GstElement *pipeline = scenario->priv->pipeline; @@ -495,6 +495,19 @@ get_position (GstValidateScenario * scenario) act = scenario->priv->actions->data; gst_element_query_position (pipeline, format, &position); + format = GST_FORMAT_TIME; + gst_element_query_duration (pipeline, format, &duration); + + if (position > duration) { + GST_VALIDATE_REPORT (scenario, + QUERY_POSITION_SUPERIOR_DURATION, + "Reported position %" GST_TIME_FORMAT " > reported duration %" + GST_TIME_FORMAT, GST_TIME_ARGS (position), GST_TIME_ARGS (duration)); + + return TRUE; + } + + GST_LOG ("Current position: %" GST_TIME_FORMAT, GST_TIME_ARGS (position)); if ((rate > 0 && (GstClockTime) position >= act->playback_time) || (rate < 0 && (GstClockTime) position <= act->playback_time)) {