mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
tests: adaptive: update to allow more flexible seeking tests
Allows defining a seek event to be able to change seeking parameters and create more seeking test scenarios
This commit is contained in:
parent
2784ff6693
commit
5bc6769532
4 changed files with 26 additions and 8 deletions
|
@ -77,6 +77,7 @@ gst_adaptive_demux_test_case_clear (GstAdaptiveDemuxTestCase * testData)
|
|||
testData->signal_context = NULL;
|
||||
testData->test_task_state = TEST_TASK_STATE_NOT_STARTED;
|
||||
testData->threshold_for_seek = 0;
|
||||
gst_event_replace (&testData->seek_event, NULL);
|
||||
testData->signal_context = NULL;
|
||||
}
|
||||
|
||||
|
@ -251,6 +252,7 @@ typedef struct _SeekTaskContext
|
|||
{
|
||||
GstElement *pipeline;
|
||||
GstTask *task;
|
||||
GstEvent *seek_event;
|
||||
} SeekTaskContext;
|
||||
|
||||
/* function to generate a seek event. Will be run in a separate thread */
|
||||
|
@ -262,15 +264,12 @@ testSeekTaskDoSeek (gpointer user_data)
|
|||
|
||||
GST_DEBUG ("testSeekTaskDoSeek calling seek");
|
||||
|
||||
/* seek to 5ms.
|
||||
* Because there is only one fragment, we expect the whole file to be
|
||||
* downloaded again
|
||||
*/
|
||||
if (!gst_element_seek_simple (GST_ELEMENT (context->pipeline),
|
||||
GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT,
|
||||
5 * GST_MSECOND)) {
|
||||
fail_unless (GST_IS_EVENT (context->seek_event));
|
||||
fail_unless (GST_EVENT_TYPE (context->seek_event) == GST_EVENT_SEEK);
|
||||
|
||||
if (!gst_element_send_event (GST_ELEMENT (context->pipeline),
|
||||
context->seek_event))
|
||||
fail ("Seek failed!\n");
|
||||
}
|
||||
GST_DEBUG ("seek ok");
|
||||
task = context->task;
|
||||
g_slice_free (SeekTaskContext, context);
|
||||
|
@ -317,6 +316,7 @@ testSeekAdaptiveDemuxSendsData (GstAdaptiveDemuxTestEngine * engine,
|
|||
|
||||
seekContext = g_slice_new (SeekTaskContext);
|
||||
seekContext->pipeline = engine->pipeline;
|
||||
seekContext->seek_event = gst_event_ref (testData->seek_event);
|
||||
testData->test_task = seekContext->task =
|
||||
gst_task_new ((GstTaskFunction) testSeekTaskDoSeek, seekContext, NULL);
|
||||
gst_task_set_lock (testData->test_task, &testData->test_task_lock);
|
||||
|
|
|
@ -105,6 +105,7 @@ typedef struct _GstAdaptiveDemuxTestCase
|
|||
* demux to AppSink before triggering a seek request
|
||||
*/
|
||||
guint64 threshold_for_seek;
|
||||
GstEvent *seek_event;
|
||||
|
||||
gpointer signal_context;
|
||||
} GstAdaptiveDemuxTestCase;
|
||||
|
|
|
@ -486,6 +486,15 @@ GST_START_TEST (testSeek)
|
|||
*/
|
||||
testData->threshold_for_seek = 4687 + 1;
|
||||
|
||||
/* seek to 5ms.
|
||||
* Because there is only one fragment, we expect the whole file to be
|
||||
* downloaded again
|
||||
*/
|
||||
testData->seek_event =
|
||||
gst_event_new_seek (1.0, GST_FORMAT_TIME,
|
||||
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT, GST_SEEK_TYPE_SET,
|
||||
5 * GST_MSECOND, GST_SEEK_TYPE_NONE, 0);
|
||||
|
||||
gst_test_http_src_install_callbacks (&http_src_callbacks, inputTestData);
|
||||
gst_adaptive_demux_test_seek (DEMUX_ELEMENT_NAME,
|
||||
"http://unit.test/test.mpd", testData);
|
||||
|
|
|
@ -374,7 +374,15 @@ GST_START_TEST (testSeek)
|
|||
|
||||
http_src_callbacks.src_start = gst_hlsdemux_test_src_start;
|
||||
http_src_callbacks.src_create = gst_hlsdemux_test_src_create;
|
||||
/* seek to 5ms.
|
||||
* Because there is only one fragment, we expect the whole file to be
|
||||
* downloaded again
|
||||
*/
|
||||
engineTestData->threshold_for_seek = 20 * TS_PACKET_LEN;
|
||||
engineTestData->seek_event =
|
||||
gst_event_new_seek (1.0, GST_FORMAT_TIME,
|
||||
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT, GST_SEEK_TYPE_SET,
|
||||
5 * GST_MSECOND, GST_SEEK_TYPE_NONE, 0);
|
||||
|
||||
gst_test_http_src_install_callbacks (&http_src_callbacks, &hlsTestCase);
|
||||
gst_adaptive_demux_test_seek (DEMUX_ELEMENT_NAME,
|
||||
|
|
Loading…
Reference in a new issue