validate: Fix the check of action that can be *not* executed

The check was wrong and we ended up allowing seek actions to no be
executed.

API:
    GST_VALIDATE_ACTION_TYPE_NO_EXECUTION_NOT_FATAL

https://bugzilla.gnome.org/show_bug.cgi?id=743994
This commit is contained in:
Thibault Saunier 2014-12-13 23:23:11 +01:00
parent 5069e0347c
commit 11f923fa52
3 changed files with 31 additions and 19 deletions

View File

@ -1421,24 +1421,28 @@ message_cb (GstBus * bus, GstMessage * message, GstValidateScenario * scenario)
scenario->priv->on_addition_actions) {
guint nb_actions = 0;
gchar *actions = g_strdup (""), *tmpconcat;
GList *tmp = g_list_concat (scenario->priv->actions,
scenario->priv->interlaced_actions);
GList *tmp;
GList *all_actions =
g_list_concat (tmp, scenario->priv->on_addition_actions);
g_list_concat (g_list_concat (scenario->priv->actions,
scenario->priv->interlaced_actions),
scenario->priv->on_addition_actions);
for (tmp = all_actions; tmp; tmp = tmp->next) {
GstValidateAction *action = ((GstValidateAction *) tmp->data);
gchar *action_string;
GstValidateAction *action = ((GstValidateAction *) tmp->data);
GstValidateActionType *type = _find_action_type (action->type);
tmpconcat = actions;
action_string = gst_structure_to_string (action->structure);
if (g_regex_match_simple ("eos|stop", action_string, 0, 0)) {
if (type->flags & GST_VALIDATE_ACTION_TYPE_NO_EXECUTION_NOT_FATAL) {
gst_validate_action_unref (action);
g_free (action_string);
continue;
}
nb_actions++;
action_string = gst_structure_to_string (action->structure);
actions =
g_strdup_printf ("%s\n%*s%s", actions, 20, "", action_string);
gst_validate_action_unref (action);
@ -2457,10 +2461,12 @@ init_scenarios (void)
"Sets the pipeline state to PLAYING", GST_VALIDATE_ACTION_TYPE_NONE);
REGISTER_ACTION_TYPE ("stop", _execute_stop, NULL,
"Sets the pipeline state to NULL", GST_VALIDATE_ACTION_TYPE_NONE);
"Sets the pipeline state to NULL",
GST_VALIDATE_ACTION_TYPE_NO_EXECUTION_NOT_FATAL);
REGISTER_ACTION_TYPE ("eos", _execute_eos, NULL,
"Sends an EOS event to the pipeline", GST_VALIDATE_ACTION_TYPE_NONE);
"Sends an EOS event to the pipeline",
GST_VALIDATE_ACTION_TYPE_NO_EXECUTION_NOT_FATAL);
REGISTER_ACTION_TYPE ("switch-track", _execute_switch_track,
((GstValidateActionParameter []) {

View File

@ -118,6 +118,8 @@ typedef struct _GstValidateActionType GstValidateActionType;
* is specified
* @GST_VALIDATE_ACTION_TYPE_NEEDS_CLOCK: The pipeline will need to be synchronized with the clock
* for that action type to be used.
* @GST_VALIDATE_ACTION_TYPE_NO_EXECUTION_NOT_FATAL: Do not concider the non execution of the action
* as a fatal error.
*/
typedef enum
{
@ -127,6 +129,7 @@ typedef enum
GST_VALIDATE_ACTION_TYPE_INTERLACED = 1 << 3,
GST_VALIDATE_ACTION_TYPE_CAN_EXECUTE_ON_ADDITION = 1 << 4,
GST_VALIDATE_ACTION_TYPE_NEEDS_CLOCK = 1 << 5,
GST_VALIDATE_ACTION_TYPE_NO_EXECUTION_NOT_FATAL = 1 << 6,
} GstValidateActionTypeFlags;
struct _GstValidateActionType

View File

@ -329,22 +329,25 @@ class GstValidateMixerTestsGenerator(GstValidatePipelineTestsGenerator):
else:
pipe_arguments = {"mixer": self.mixer}
if self.test_manager.options.mute:
pipe_arguments["sink"] = "'fakesink'"
else:
pipe_arguments["sink"] = "auto%ssink" % self.media_type
pipe = self._pipeline_template % pipe_arguments
for src in srcs:
pipe += "%s ! _mixer. " % src
for scenario in scenarios:
fname = self.get_fname(scenario, Protocols.FILE) + "."
fname += name
self.debug("Adding: %s", fname)
if self.test_manager.options.mute:
if scenario.needs_clock_sync():
pipe_arguments["sink"] = "fakesink sync=true"
else:
pipe_arguments["sink"] = "'fakesink'"
else:
pipe_arguments["sink"] = "auto%ssink" % self.media_type
pipe = self._pipeline_template % pipe_arguments
for src in srcs:
pipe += "%s ! _mixer. " % src
self.add_test(GstValidateLaunchTest(fname,
self.test_manager.options,
self.test_manager.reporter,