From 5e0e092112b906854b04c06fc13fec2ab6fdf87b Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 19 Feb 2014 09:56:12 +0100 Subject: [PATCH] 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 --- validate/gst/validate/gst-validate-scenario.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/validate/gst/validate/gst-validate-scenario.c b/validate/gst/validate/gst-validate-scenario.c index 8707b6f181..967b5ae307 100644 --- a/validate/gst/validate/gst-validate-scenario.c +++ b/validate/gst/validate/gst-validate-scenario.c @@ -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 message_cb (GstBus * bus, GstMessage * message, GstValidateScenario * scenario) { @@ -704,6 +715,9 @@ message_cb (GstBus * bus, GstMessage * message, GstValidateScenario * scenario) return FALSE; } + + priv->actions = g_list_insert_sorted (priv->actions, action, + (GCompareFunc) _compare_actions); } g_list_free (priv->needs_parsing); @@ -909,7 +923,7 @@ _load_scenario_file (GstValidateScenario * scenario, gdouble playback_time; GstValidateAction *action; GstValidateActionType *action_type; - const gchar *type, *str_playback_time; + const gchar *type, *str_playback_time = NULL; GstStructure *structure = tmp->data; @@ -951,7 +965,8 @@ _load_scenario_file (GstValidateScenario * scenario, } 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: