validate: scenario: Mark action as being executed right before calling ->execute
authorThibault Saunier <tsaunier@igalia.com>
Tue, 29 Jan 2019 15:54:01 +0000 (12:54 -0300)
committerThibault Saunier <tsaunier@igalia.com>
Tue, 29 Jan 2019 16:09:36 +0000 (13:09 -0300)
And make sure that we do not try to execute the following action

In the case the action type leads to the GMainContext to be ieterated

validate/gst/validate/gst-validate-scenario.c
validate/gst/validate/gst-validate-scenario.h

index f608f26..319d76b 100644 (file)
@@ -1704,6 +1704,7 @@ gst_validate_execute_action (GstValidateActionType * action_type,
   gst_validate_print_action (action, NULL);
 
   action->priv->execution_time = gst_util_get_timestamp ();
+  action->priv->state = GST_VALIDATE_EXECUTE_ACTION_IN_PROGRESS;
   res = action_type->execute (scenario, action);
   gst_object_unref (scenario);
 
@@ -1958,7 +1959,11 @@ execute_next_action (GstValidateScenario * scenario)
     act = scenario->priv->actions->data;
 
   if (act) {
-    if (act->priv->state == GST_VALIDATE_EXECUTE_ACTION_OK && act->repeat <= 0) {
+
+    if (act->priv->state == GST_VALIDATE_EXECUTE_ACTION_IN_PROGRESS) {
+      return G_SOURCE_CONTINUE;
+    } else if (act->priv->state == GST_VALIDATE_EXECUTE_ACTION_OK
+        && act->repeat <= 0) {
       tmp = priv->actions;
       priv->actions = g_list_remove_link (priv->actions, tmp);
 
index aa74c58..94e49af 100644 (file)
@@ -46,7 +46,8 @@ typedef enum
   GST_VALIDATE_EXECUTE_ACTION_OK,
   GST_VALIDATE_EXECUTE_ACTION_ASYNC,
   GST_VALIDATE_EXECUTE_ACTION_INTERLACED,
-  GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED
+  GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED,
+  GST_VALIDATE_EXECUTE_ACTION_IN_PROGRESS
 } GstValidateActionReturn;
 
 /* TODO 2.0 -- Make it an actual enum type */