validate-scenario: Avoid timeouts on EOS
authorEdward Hervey <edward@centricular.com>
Mon, 14 Nov 2022 06:27:28 +0000 (07:27 +0100)
committerEdward Hervey <bilboed@bilboed.com>
Tue, 15 Nov 2022 06:47:49 +0000 (07:47 +0100)
If there is an EOS and the next action is waiting for a playback time, execute
it since we are guaranteed the position won't change anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3403>

subprojects/gst-devtools/validate/gst/validate/gst-validate-report.c
subprojects/gst-devtools/validate/gst/validate/gst-validate-report.h
subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c

index 1d7a250..0ab9e25 100644 (file)
@@ -534,6 +534,8 @@ gst_validate_report_load_issues (void)
       GST_VALIDATE_ISSUE_FLAGS_FULL_DETAILS);
   REGISTER_VALIDATE_ISSUE (ISSUE, SCENARIO_ACTION_EXECUTION_ISSUE,
       "An issue happened during the execution of a scenario", NULL);
+  REGISTER_VALIDATE_ISSUE (WARNING, SCENARIO_ACTION_ENDED_EARLY,
+      "Got EOS before an action playback time", NULL);
   REGISTER_VALIDATE_ISSUE (CRITICAL, CONFIG_LATENCY_TOO_HIGH,
       "The pipeline latency is higher than the maximum allowed by the scenario",
       NULL);
index 8a24a87..1f8acd2 100644 (file)
@@ -138,6 +138,12 @@ typedef enum {
 #define SCENARIO_ACTION_CHECK_ERROR              _QUARK("scenario::check-error")
 #define SCENARIO_ACTION_TIMEOUT                  _QUARK("scenario::action-timeout")
 #define SCENARIO_ACTION_EXECUTION_ISSUE          _QUARK("scenario::execution-issue")
+/**
+ * SCENARIO_ACTION_ENDED_EARLY:
+ *
+ * Since: 1.22
+ */
+#define SCENARIO_ACTION_ENDED_EARLY              _QUARK("scenario::action-ended-early")
 
 #define CONFIG_LATENCY_TOO_HIGH                  _QUARK("config::latency-too-high")
 #define CONFIG_TOO_MANY_BUFFERS_DROPPED          _QUARK("config::too-many-buffers-dropped")
index 696f856..47fec1e 100644 (file)
@@ -2688,6 +2688,15 @@ execute_next_action_full (GstValidateScenario * scenario, GstMessage * message)
     return G_SOURCE_CONTINUE;
   }
 
+  if (message && GST_MESSAGE_TYPE (message) == GST_MESSAGE_EOS
+      && act->playback_time != GST_CLOCK_TIME_NONE) {
+    GST_VALIDATE_REPORT_ACTION (scenario, act,
+        SCENARIO_ACTION_ENDED_EARLY,
+        "Got EOS before action playback time %" GST_TIME_FORMAT,
+        GST_TIME_ARGS (act->playback_time));
+    goto execute_action;
+  }
+
   switch (act->priv->state) {
     case GST_VALIDATE_EXECUTE_ACTION_NONE:
     case GST_VALIDATE_EXECUTE_ACTION_NON_BLOCKING:
@@ -2734,6 +2743,7 @@ execute_next_action_full (GstValidateScenario * scenario, GstMessage * message)
     return G_SOURCE_CONTINUE;
   }
 
+execute_action:
   type = _find_action_type (act->type);
 
   GST_DEBUG_OBJECT (scenario, "Executing %" GST_PTR_FORMAT