Module: wine Branch: master Commit: b924671ea83a097f90fefa2998acbedc5580829a URL: https://gitlab.winehq.org/wine/wine/-/commit/b924671ea83a097f90fefa2998acbed...
Author: Zebediah Figura zfigura@codeweavers.com Date: Tue Jan 24 15:04:16 2023 -0600
mfreadwrite/tests: Avoid depending on sample size in test_source_reader().
At the same time, avoid depending on file length.
---
dlls/mfreadwrite/tests/mfplat.c | 48 ++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 32 deletions(-)
diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c index 14e92cceab2..b28a2bf775b 100644 --- a/dlls/mfreadwrite/tests/mfplat.c +++ b/dlls/mfreadwrite/tests/mfplat.c @@ -782,14 +782,22 @@ static void test_source_reader(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); IMFMediaType_Release(mediatype);
- hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, &actual_index, &stream_flags, - ×tamp, &sample); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - if (hr != S_OK) - goto skip_read_sample; - ok(!actual_index, "Unexpected stream index %lu.\n", actual_index); - ok(!stream_flags, "Unexpected stream flags %#lx.\n", stream_flags); - IMFSample_Release(sample); + for (;;) + { + hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, &actual_index, &stream_flags, + ×tamp, &sample); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(!actual_index, "Unexpected stream index %lu.\n", actual_index); + ok(!(stream_flags & ~MF_SOURCE_READERF_ENDOFSTREAM), "Unexpected stream flags %#lx.\n", stream_flags); + + if (stream_flags & MF_SOURCE_READERF_ENDOFSTREAM) + { + ok(!sample, "Unexpected sample object.\n"); + break; + } + + IMFSample_Release(sample); + }
/* There is no video stream. */ hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0, &actual_index, &stream_flags, @@ -805,28 +813,6 @@ static void test_source_reader(void) hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0, NULL, NULL, ×tamp, &sample); ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
- hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, &actual_index, &stream_flags, - ×tamp, &sample); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - ok(!actual_index, "Unexpected stream index %lu.\n", actual_index); - /* TODO: gstreamer outputs .wav sample in increments of 4096, instead of 4410 */ - todo_wine -{ - ok(stream_flags == MF_SOURCE_READERF_ENDOFSTREAM, "Unexpected stream flags %#lx.\n", stream_flags); - ok(!sample, "Unexpected sample object.\n"); -} - if(!stream_flags) - { - IMFSample_Release(sample); - - hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, &actual_index, &stream_flags, - ×tamp, &sample); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - ok(!actual_index, "Unexpected stream index %lu.\n", actual_index); - ok(stream_flags == MF_SOURCE_READERF_ENDOFSTREAM, "Unexpected stream flags %#lx.\n", stream_flags); - ok(!sample, "Unexpected sample object.\n"); - } - hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, MF_SOURCE_READER_CONTROLF_DRAIN, &actual_index, &stream_flags, ×tamp, &sample); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -862,8 +848,6 @@ static void test_source_reader(void) ok(stream_flags == MF_SOURCE_READERF_ENDOFSTREAM, "Unexpected stream flags %#lx.\n", stream_flags); ok(!sample, "Unexpected sample object.\n");
-skip_read_sample: - /* Flush. */ hr = IMFSourceReader_Flush(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM); ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#lx.\n", hr);