validate: Add actions to the actions list only when they are fully parsed

Otherwize in some corner cases they can be executed before they are actually parsed
This commit is contained in:
Thibault Saunier 2014-02-19 09:56:12 +01:00
parent 2f44d15e0b
commit 5e0e092112

View file

@ -676,6 +676,17 @@ gst_validate_scenario_update_segment_from_seek (GstValidateScenario * scenario,
} }
} }
static gint
_compare_actions (GstValidateAction *a, GstValidateAction * b)
{
if (a->action_number < b->action_number)
return -1;
else if (a->action_number == b->action_number)
return 0;
return 1;
}
static gboolean static gboolean
message_cb (GstBus * bus, GstMessage * message, GstValidateScenario * scenario) message_cb (GstBus * bus, GstMessage * message, GstValidateScenario * scenario)
{ {
@ -704,6 +715,9 @@ message_cb (GstBus * bus, GstMessage * message, GstValidateScenario * scenario)
return FALSE; return FALSE;
} }
priv->actions = g_list_insert_sorted (priv->actions, action,
(GCompareFunc) _compare_actions);
} }
g_list_free (priv->needs_parsing); g_list_free (priv->needs_parsing);
@ -909,7 +923,7 @@ _load_scenario_file (GstValidateScenario * scenario,
gdouble playback_time; gdouble playback_time;
GstValidateAction *action; GstValidateAction *action;
GstValidateActionType *action_type; GstValidateActionType *action_type;
const gchar *type, *str_playback_time; const gchar *type, *str_playback_time = NULL;
GstStructure *structure = tmp->data; GstStructure *structure = tmp->data;
@ -951,7 +965,8 @@ _load_scenario_file (GstValidateScenario * scenario,
} }
action->action_number = priv->num_actions++; action->action_number = priv->num_actions++;
priv->actions = g_list_append (priv->actions, action); if (str_playback_time == NULL)
priv->actions = g_list_append (priv->actions, action);
} }
done: done: