From fca2411e77ca4a4afaaf2a607cacd08f9a2a9916 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Sat, 16 Mar 2019 18:05:56 -0300 Subject: [PATCH] validate:scenario: Add a way to ignore EOS And ignore then in seek_forward/backward to avoid cases where the pipeline EOS before we have the chance to launch the following seek, see: https://ci.gstreamer.net/job/GStreamer-master-meson-validate/3483/testReport/junit/(root)/gst-validate-launcher/validate_rtsp_playback_seek_backward_raw_h264_1_mp4/ --- .../scenarios/change_state_intensive.scenario | 2 +- validate/data/scenarios/fast_backward.scenario | 4 +++- validate/data/scenarios/fast_forward.scenario | 5 +++-- validate/data/scenarios/seek_backward.scenario | 2 +- validate/data/scenarios/seek_forward.scenario | 4 ++-- validate/gst/validate/gst-validate-scenario.c | 16 ++++++++++++++++ 6 files changed, 26 insertions(+), 7 deletions(-) diff --git a/validate/data/scenarios/change_state_intensive.scenario b/validate/data/scenarios/change_state_intensive.scenario index e8b5eb0c0c..06ac60e72b 100644 --- a/validate/data/scenarios/change_state_intensive.scenario +++ b/validate/data/scenarios/change_state_intensive.scenario @@ -1,3 +1,3 @@ -description, duration=0, summary="Set state to NULL->PLAYING->NULL 20 times", need-clock-sync=true, min-media-duration=1.0, live_content_compatible=True, handles-states=true +description, duration=0, summary="Set state to NULL->PLAYING->NULL 20 times", need-clock-sync=true, min-media-duration=1.0, live_content_compatible=True, handles-states=true, ignore-eos=true set-state, state="playing", sub-action="set-state, state=null", repeat=40 stop; diff --git a/validate/data/scenarios/fast_backward.scenario b/validate/data/scenarios/fast_backward.scenario index c51b430857..f16072d506 100644 --- a/validate/data/scenarios/fast_backward.scenario +++ b/validate/data/scenarios/fast_backward.scenario @@ -1,7 +1,9 @@ -description, duration=30.0, minfo-media-duration=310.0, seek=true, reverse-playback=true, need-clock-sync=true, min-media-duration=310.0 +description, duration=30.0, minfo-media-duration=310.0, seek=true, reverse-playback=true, need-clock-sync=true, min-media-duration=310.0, ignore-eos=true include,location=includes/default-seek-flags.scenario seek, name=Fast-backward-seek, playback-time=0.0, rate=-2.0, start=0.0, stop=310.0, flags="$(default_flags)" seek, name=Fast-backward-seek, playback-time=300.0, rate=-4.0, start=0.0, stop=300.0, flags="$(default_flags)" seek, name=Fast-backward-seek, playback-time=280.0, rate=-8.0, start=0.0, stop=280.0, flags="$(default_flags)" seek, name=Fast-backward-seek, playback-time=240.0, rate=-16.0, start=0.0, stop=240.0, flags="$(default_flags)" seek, name=Fast-backward-seek, playback-time=160.0, rate=-32.0, start=0.0, stop=160.0, flags="$(default_flags)" +wait, message-type=eos +stop \ No newline at end of file diff --git a/validate/data/scenarios/fast_forward.scenario b/validate/data/scenarios/fast_forward.scenario index 9969a5d5d0..78645a72ae 100644 --- a/validate/data/scenarios/fast_forward.scenario +++ b/validate/data/scenarios/fast_forward.scenario @@ -1,8 +1,9 @@ -description, duration=25.0, seek=true, need-clock-sync=true, min-media-duration=5.0 +description, duration=25.0, seek=true, need-clock-sync=true, min-media-duration=5.0, ignore-eos=true include,location=includes/default-seek-flags.scenario seek, name=Fast-forward-seek, playback-time=0.0, rate=2.0, start=0.0, flags="$(default_flags)" seek, name=Fast-forward-seek, playback-time="min(10.0, $(duration) * 0.0625)", rate=4.0, start=0.0, flags="$(default_flags)" seek, name=Fast-forward-seek, playback-time="min(20.0, $(duration) * 0.125)", rate=8.0, start=0.0, flags="$(default_flags)" seek, name=Fast-forward-seek, playback-time="min(40.0, $(duration) * 0.25)", rate=16.0, start=0.0, flags="$(default_flags)" seek, name=Fast-forward-seek, playback-time="min(80.0, $(duration) * 0.50)", rate=32.0, start=0.0, flags="$(default_flags)" -stop, playback-time="min($(duration) - 0.3, 160.0)" +wait, message-type=eos +stop \ No newline at end of file diff --git a/validate/data/scenarios/seek_backward.scenario b/validate/data/scenarios/seek_backward.scenario index 25e1ad6a64..66c9cd3dd3 100644 --- a/validate/data/scenarios/seek_backward.scenario +++ b/validate/data/scenarios/seek_backward.scenario @@ -1,4 +1,4 @@ -description, seek=true, duration=30, need-clock-sync=true +description, seek=true, duration=30, need-clock-sync=true, ignore-eos=true include,location=includes/default-seek-flags.scenario seek, name=Backward-seek, playback-time="min(5.0, ($(duration) / 4))", rate=1.0, start=0.0, flags="$(default_flags)" seek, name=Backward-seek, playback-time="min(10.0, 2*($(duration) / 4))", rate=1.0, start="min(5.0, $(duration) / 4)", flags="$(default_flags)" diff --git a/validate/data/scenarios/seek_forward.scenario b/validate/data/scenarios/seek_forward.scenario index c5b290fc56..7069b7f9eb 100644 --- a/validate/data/scenarios/seek_forward.scenario +++ b/validate/data/scenarios/seek_forward.scenario @@ -1,6 +1,6 @@ -description, seek=true, duration=20, need-clock-sync=true +description, seek=true, duration=20, need-clock-sync=true, ignore-eos=true include,location=includes/default-seek-flags.scenario seek, name=First-forward-seek, playback-time="min(5.0, ($(duration)/8))", start="min(10, 2*($(duration)/8))", flags="$(default_flags)" seek, name=Second-forward-seek, playback-time="min(15.0, 3*($(duration)/8))", start="min(20, 4*($(duration)/8))", flags="$(default_flags)" seek, name=Third-forward-seek, playback-time="min(25, 5*($(duration)/8))", start="min(30.0, 6*($(duration)/8))", flags="$(default_flags)" -stop, playback-time=35.0 +stop, playback-time="min($(duration) - 1, 35)" diff --git a/validate/gst/validate/gst-validate-scenario.c b/validate/gst/validate/gst-validate-scenario.c index c6aa5ad1e5..8b4e8e7369 100644 --- a/validate/gst/validate/gst-validate-scenario.c +++ b/validate/gst/validate/gst-validate-scenario.c @@ -158,6 +158,7 @@ struct _GstValidateScenarioPrivate gboolean got_eos; gboolean changing_state; gboolean needs_async_done; + gboolean ignore_eos; GstState target_state; GList *overrides; @@ -3135,6 +3136,11 @@ message_cb (GstBus * bus, GstMessage * message, GstValidateScenario * scenario) GstValidateActionType *stop_action_type; GstStructure *s; + if (!is_error && scenario->priv->ignore_eos) { + GST_INFO_OBJECT (scenario, "Got EOS but ignoring it!"); + goto done; + } + GST_VALIDATE_SCENARIO_EOS_HANDLING_LOCK (scenario); { /* gst_validate_action_set_done() does not finish the action @@ -3376,6 +3382,7 @@ _load_scenario_file (GstValidateScenario * scenario, gst_structure_get_boolean (structure, "is-config", is_config); gst_structure_get_boolean (structure, "handles-states", &priv->handles_state); + gst_structure_get_boolean (structure, "ignore-eos", &priv->ignore_eos); if (!priv->handles_state) priv->target_state = GST_STATE_PLAYING; @@ -4733,6 +4740,15 @@ init_scenarios (void) .possible_variables = NULL, .def = "infinite (-1)" }, + { + .name = "ignore-eos", + .description = "Ignore EOS and keep executing the scenario when it happens.\n By default " + "a 'stop' action is generated one EOS", + .mandatory = FALSE, + .types = "boolean", + .possible_variables = NULL, + .def = "false" + }, {NULL} }), "Allows to describe the scenario in various ways",