From eab86c29135e5ac43cd6977bece7afb532affec2 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 6 Aug 2013 18:35:24 +0200 Subject: [PATCH] tests: integration: Rework the way we handle seeking while fully paused The idea is that we should first play until the time we reach the first position, at that point we PAUSE the pipeline, then, afterward do the seeks as asked. If we get the position before the ASYNC DONE, just accept it. --- tests/check/ges/integration.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/tests/check/ges/integration.c b/tests/check/ges/integration.c index eaac73d33c..f6f4a6f9cc 100644 --- a/tests/check/ges/integration.c +++ b/tests/check/ges/integration.c @@ -211,6 +211,12 @@ my_bus_callback (GstBus * bus, GstMessage * message, gpointer data) got_async_done = TRUE; if (GST_CLOCK_TIME_IS_VALID (seeked_position)) seeked_position = GST_CLOCK_TIME_NONE; + + if (seeks == NULL && seek_paused_noplay) { + /* We are now done with seeking, let it play until the end */ + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); + gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, -1); + } break; default: /* unhandled message */ @@ -234,7 +240,8 @@ get_position (void) if ((position >= (seek->seeking_position - seek_tol)) && (position <= (seek->seeking_position + seek_tol))) { - fail_if (GST_CLOCK_TIME_IS_VALID (seeked_position)); + if (!got_async_done) + fail_if (GST_CLOCK_TIME_IS_VALID (seeked_position)); got_async_done = FALSE; GST_INFO ("seeking to: %" GST_TIME_FORMAT, @@ -242,6 +249,13 @@ get_position (void) seeked_position = seek->position; if (seek_paused) { + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED); + GST_LOG ("Set state playing"); + gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, -1); + GST_LOG ("Done wainting"); + } + + if (seek_paused_noplay) { gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED); gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, -1); } @@ -262,10 +276,6 @@ get_position (void) } /* if seeking paused without playing and we reached the last seek, just play * till the end */ - if (!tmp && seek_paused_noplay) { - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, -1); - } return TRUE; } @@ -338,10 +348,8 @@ check_timeline (GESTimeline * timeline) gst_object_unref (bus); ges_pipeline_add_timeline (pipeline, timeline); - if (!seek_paused_noplay) { - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, -1); - } + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); + gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, -1); GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "ges-integration-playing"); if (seeks != NULL)