validate: Check that position <= duration from the pipeline monitor
authorThibault Saunier <tsaunier@igalia.com>
Sun, 10 Mar 2019 20:06:13 +0000 (17:06 -0300)
committerThibault Saunier <tsaunier@igalia.com>
Mon, 11 Mar 2019 21:14:23 +0000 (18:14 -0300)
We should not require a scenario for that check to happen

validate/gst/validate/gst-validate-pipeline-monitor.c

index 65e99f7..36794d0 100644 (file)
@@ -125,6 +125,13 @@ print_position (GstValidateMonitor * monitor)
     goto done;
   }
 
+  if (position > duration) {
+    GST_VALIDATE_REPORT (monitor,
+        QUERY_POSITION_SUPERIOR_DURATION,
+        "Reported position %" GST_TIME_FORMAT " > reported duration %"
+        GST_TIME_FORMAT, GST_TIME_ARGS (position), GST_TIME_ARGS (duration));
+  }
+
   query = gst_query_new_segment (GST_FORMAT_DEFAULT);
   if (gst_element_query (pipeline, query))
     gst_query_parse_segment (query, &rate, NULL, NULL, NULL);
@@ -531,6 +538,9 @@ _bus_handler (GstBus * bus, GstMessage * message,
     g_string_free (str, TRUE);
   }
   switch (GST_MESSAGE_TYPE (message)) {
+    case GST_MESSAGE_EOS:
+      print_position (GST_VALIDATE_MONITOR (monitor));
+      break;
     case GST_MESSAGE_ERROR:
       gst_message_parse_error (message, &err, &debug);
       gst_message_parse_error_details (message, &details);