mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
adaptivedemux: tests: improved checks for expected data
Check the size of received data for each buffer received by AppSink https://bugzilla.gnome.org/show_bug.cgi?id=762144
This commit is contained in:
parent
808a51dc0e
commit
3224cfd0b5
2 changed files with 26 additions and 7 deletions
|
@ -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];
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue