From 5b6b24859f969654829fbf860b9677975610bddb Mon Sep 17 00:00:00 2001 From: Florin Apostol Date: Tue, 16 Feb 2016 14:26:05 +0000 Subject: [PATCH] dashdemux: tests: added test for media download error for in stream fragment Tested download error for a fragment that is not the last media fragment in the stream. https://bugzilla.gnome.org/show_bug.cgi?id=762144 --- tests/check/elements/dash_demux.c | 87 +++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/tests/check/elements/dash_demux.c b/tests/check/elements/dash_demux.c index 7a6375b35b..8e9953868d 100644 --- a/tests/check/elements/dash_demux.c +++ b/tests/check/elements/dash_demux.c @@ -1086,6 +1086,92 @@ GST_START_TEST (testMediaDownloadErrorLastFragment) GST_END_TEST; +/* + * Test media download error on a media fragment which is not the last one. + * Let the adaptive demux download a few bytes, then instruct the + * GstTestHTTPSrc element to generate an error while a media fragment + * is being downloaded. + */ +GST_START_TEST (testMediaDownloadErrorMiddleFragment) +{ + const gchar *mpd = + "" + "" + " " + " " + " " + " " + " audio.webm" + " " + " " + " " + " " + " " + " " + " " + " " + " "; + + /* generate error on the second media fragment */ + guint64 threshold_for_trigger = 31; + + GstDashDemuxTestInputData inputTestData[] = { + {"http://unit.test/test.mpd", (guint8 *) mpd, 0}, + {"http://unit.test/audio.webm", NULL, 5000}, + {NULL, NULL, 0}, + }; + GstAdaptiveDemuxTestExpectedOutput outputTestData[] = { + /* adaptive demux will download only the first media fragment */ + {"audio_00", 20, NULL}, + }; + GstTestHTTPSrcCallbacks http_src_callbacks = { 0 }; + GstTestHTTPSrcTestData http_src_test_data = { 0 }; + GstAdaptiveDemuxTestCallbacks test_callbacks = { 0 }; + GstDashDemuxTestCase *testData; + + http_src_callbacks.src_start = gst_dashdemux_http_src_start; + http_src_callbacks.src_create = test_fragment_download_error_src_create; + http_src_test_data.data = gst_structure_new_empty (__FUNCTION__); + gst_structure_set (http_src_test_data.data, "threshold_for_trigger", + G_TYPE_UINT64, threshold_for_trigger, NULL); + http_src_test_data.input = inputTestData; + gst_test_http_src_install_callbacks (&http_src_callbacks, + &http_src_test_data); + + test_callbacks.appsink_received_data = + gst_adaptive_demux_test_check_received_data; + test_callbacks.appsink_eos = gst_adaptive_demux_test_unexpected_eos; + test_callbacks.bus_error_message = testDownloadErrorMessageCallback; + + testData = gst_dash_demux_test_case_new (); + COPY_OUTPUT_TEST_DATA (outputTestData, testData); + + gst_adaptive_demux_test_run (DEMUX_ELEMENT_NAME, + "http://unit.test/test.mpd", &test_callbacks, testData); + + g_object_unref (testData); + if (http_src_test_data.data) + gst_structure_free (http_src_test_data.data); +} + +GST_END_TEST; + /* generate queries to adaptive demux */ static gboolean testQueryCheckDataReceived (GstAdaptiveDemuxTestEngine * engine, @@ -1254,6 +1340,7 @@ dash_demux_suite (void) tcase_add_test (tc_basicTest, testDownloadError); tcase_add_test (tc_basicTest, testHeaderDownloadError); tcase_add_test (tc_basicTest, testMediaDownloadErrorLastFragment); + tcase_add_test (tc_basicTest, testMediaDownloadErrorMiddleFragment); tcase_add_test (tc_basicTest, testQuery); tcase_add_unchecked_fixture (tc_basicTest, gst_adaptive_demux_test_setup,