summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/check/elements/adaptive_demux_common.c22
-rw-r--r--tests/check/elements/hls_demux.c11
2 files changed, 26 insertions, 7 deletions
diff --git a/tests/check/elements/adaptive_demux_common.c b/tests/check/elements/adaptive_demux_common.c
index 4efd5c09f..ab5579570 100644
--- a/tests/check/elements/adaptive_demux_common.c
+++ b/tests/check/elements/adaptive_demux_common.c
@@ -163,6 +163,23 @@ gst_adaptive_demux_test_check_received_data (GstAdaptiveDemuxTestEngine *
testOutputStreamData =
gst_adaptive_demux_test_find_test_data_by_stream (testData, stream, NULL);
fail_unless (testOutputStreamData != NULL);
+
+ GST_DEBUG
+ ("total_received_size=%" G_GUINT64_FORMAT
+ " segment_received_size = %" G_GUINT64_FORMAT
+ " buffer_size=%" G_GUINT64_FORMAT
+ " expected_size=%" G_GUINT64_FORMAT
+ " segment_start = %" G_GUINT64_FORMAT,
+ stream->total_received_size,
+ stream->segment_received_size,
+ (guint64) gst_buffer_get_size (buffer),
+ testOutputStreamData->expected_size, stream->segment_start);
+
+ fail_unless (stream->total_received_size +
+ stream->segment_received_size +
+ gst_buffer_get_size (buffer) <= testOutputStreamData->expected_size,
+ "Received unexpected data, please check what segments are being downloaded");
+
streamOffset = stream->segment_start + stream->segment_received_size;
if (testOutputStreamData->expected_data) {
gsize size = gst_buffer_get_size (buffer);
@@ -178,11 +195,6 @@ gst_adaptive_demux_test_check_received_data (GstAdaptiveDemuxTestEngine *
gst_buffer_map (buffer, &info, GST_MAP_READ);
- GST_DEBUG
- ("segment_start = %" G_GUINT64_FORMAT " segment_received_size = %"
- G_GUINT64_FORMAT " bufferSize=%d",
- stream->segment_start, stream->segment_received_size, (gint) info.size);
-
pattern = streamOffset - streamOffset % sizeof (pattern);
for (guint64 i = 0; i != info.size; ++i) {
guint received = info.data[i];
diff --git a/tests/check/elements/hls_demux.c b/tests/check/elements/hls_demux.c
index 8d07ea06d..fca76b3e6 100644
--- a/tests/check/elements/hls_demux.c
+++ b/tests/check/elements/hls_demux.c
@@ -687,13 +687,20 @@ GST_START_TEST (testFragmentDownloadError)
{"http://unit.test/002.ts", NULL, segment_size},
{NULL, NULL, 0}
};
+ const guint64 failure_position = 2048;
GstAdaptiveDemuxTestExpectedOutput outputTestData[] = {
- {"src_0", 2 * segment_size, NULL},
+ /* adaptive demux tries for 4 times (MAX_DOWNLOAD_ERROR_COUNT + 1) before giving up */
+ {"src_0", failure_position * 4, NULL},
{NULL, 0, NULL}
};
- const guint64 failure_position = 2048;
TESTCASE_INIT_BOILERPLATE (segment_size);
+ /* download in chunks of failure_position size.
+ * This means the first chunk will succeed, the second will generate
+ * error because we already exceeded failure_position bytes.
+ */
+ gst_test_http_src_set_default_blocksize (failure_position);
+
http_src_callbacks.src_start = gst_hlsdemux_test_src_start;
http_src_callbacks.src_create = gst_hlsdemux_test_network_error_src_create;
gst_structure_set (hlsTestCase.state,