validate: Report an issue result of query state that position > duration

This commit is contained in:
Thibault Saunier 2013-08-23 09:39:05 -04:00 committed by Thiago Santos
parent 78d2fde632
commit 1dcfaea37f
3 changed files with 19 additions and 1 deletions

View file

@ -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

View file

@ -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 {

View file

@ -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)) {