From: Rémi Bernon rbernon@codeweavers.com
The tests are all flaky because of the current media source design, which uses high-level GStreamer abstractions, like decodebin, which internally create threads and queues, and which cannot provide any deterministic stream ordering. --- dlls/mf/tests/mf.c | 114 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 2ff157e65d8..93da65e58c0 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -6726,11 +6726,19 @@ static void test_MFRequireProtectedEnvironment(void) ok(ref == 0, "Release returned %ld\n", ref); }
+struct stream_desc +{ + UINT id; + BOOL selected; + struct attribute_desc attributes[16]; +}; + struct presentation_desc { UINT max_required_bytes; UINT stream_count; struct attribute_desc attributes[16]; + struct stream_desc streams[16]; };
static void load_resource_stream(const WCHAR *name, IMFByteStream **stream) @@ -6765,6 +6773,7 @@ static void subtest_media_source(const WCHAR *resource, const GUID *guid, const DWORD time = 0, stream_count; QWORD bytes; HRESULT hr; + UINT i;
winetest_push_context("%s", debugstr_w(resource));
@@ -6847,6 +6856,38 @@ static void subtest_media_source(const WCHAR *resource, const GUID *guid, const todo_wine_if(stream_count == 4 && expect->stream_count == 5) ok(stream_count == expect->stream_count, "got stream_count %lu\n", stream_count); check_attributes((IMFAttributes *)presentation, expect->attributes, -1); + + for (i = 0; i < stream_count; ++i) + { + const struct stream_desc *expect_stream = expect->streams + i; + IMFMediaTypeHandler *type_handler; + IMFStreamDescriptor *stream; + DWORD id, type_count; + BOOL selected; + + winetest_push_context("%u", i); + + hr = IMFPresentationDescriptor_GetStreamDescriptorByIndex(presentation, i, &selected, &stream); + ok(hr == S_OK, "got hr %#lx\n", hr); + todo_wine_if(!expect_stream->selected) + ok(selected == expect_stream->selected, "got selected %u\n", selected); + hr = IMFStreamDescriptor_GetStreamIdentifier(stream, &id); + ok(hr == S_OK, "got hr %#lx\n", hr); + todo_wine ok(id == expect_stream->id, "got id %lu\n", id); + flaky_wine check_attributes((IMFAttributes *)stream, expect_stream->attributes, -1); + + hr = IMFStreamDescriptor_GetMediaTypeHandler(stream, &type_handler); + ok(hr == S_OK, "got hr %#lx\n", hr); + hr = IMFMediaTypeHandler_GetMediaTypeCount(type_handler, &type_count); + ok(hr == S_OK, "got hr %#lx\n", hr); + todo_wine ok(type_count == 1, "got type_count %lu\n", type_count); + + IMFMediaTypeHandler_Release(type_handler); + IMFStreamDescriptor_Release(stream); + + winetest_pop_context(); + } + IMFPresentationDescriptor_Release(presentation);
hr = IMFMediaSource_Shutdown(media_source); @@ -6878,6 +6919,52 @@ static void test_media_source(void) ATTR_RATIO(MF_PD_TOTAL_FILE_SIZE, 0, 33041, .todo = TRUE), ATTR_WSTR_OR_NONE(MF_PD_MIME_TYPE, L"video/mp4", .todo = TRUE), }, + .streams = + { + { + .id = 1, + .attributes = + { + ATTR_WSTR(MF_SD_LANGUAGE, L"fr", /* flaky, .todo = TRUE */), + ATTR_UINT32(MF_SD_MUTUALLY_EXCLUSIVE, 1, .todo = TRUE), + }, + }, + { + .id = 2, + .selected = 1, + .attributes = + { + ATTR_WSTR(MF_SD_LANGUAGE, L"en", /* flaky, .todo_value = TRUE */), + ATTR_UINT32(MF_SD_MUTUALLY_EXCLUSIVE, 1, .todo = TRUE), + ATTR_WSTR_OR_NONE(MF_SD_STREAM_NAME, L"This is a very long audio stream title string", .todo_value = TRUE), + }, + }, + { + .id = 3, + .attributes = + { + ATTR_UINT32(MF_SD_MUTUALLY_EXCLUSIVE, 1, .todo = TRUE), + ATTR_WSTR_OR_NONE(MF_SD_STREAM_NAME, L"First Video", /* flaky, .todo = TRUE */), + }, + }, + { + .id = 4, + .attributes = + { + ATTR_UINT32(MF_SD_MUTUALLY_EXCLUSIVE, 1, .todo = TRUE), + }, + }, + { + .id = 5, + .selected = 1, + .attributes = + { + ATTR_WSTR(MF_SD_LANGUAGE, L"de", /* flaky, .todo_value = TRUE */), + ATTR_UINT32(MF_SD_MUTUALLY_EXCLUSIVE, 1, .todo = TRUE), + ATTR_WSTR_OR_NONE(MF_SD_STREAM_NAME, L"Other Video", /* flaky, .todo = TRUE */), + }, + }, + }, }; const struct presentation_desc avi_desc = { @@ -6891,6 +6978,33 @@ static void test_media_source(void) ATTR_UINT32(MF_PD_VIDEO_ENCODING_BITRATE, 1125200, .todo = TRUE), ATTR_WSTR_OR_NONE(MF_PD_MIME_TYPE, L"video/avi", .todo = TRUE), }, + .streams = + { + { + .id = 1, + .selected = 1, + .attributes = + { + ATTR_UINT32(MF_SD_MUTUALLY_EXCLUSIVE, 1, .todo = TRUE), + ATTR_WSTR(MF_SD_STREAM_NAME, L"This is a very long audio stream title string", /* flaky, .todo = TRUE */), + }, + }, + { + .id = 2, + .selected = 1, + .attributes = + { + ATTR_WSTR(MF_SD_STREAM_NAME, L"Video", /* flaky, .todo = TRUE */), + }, + }, + { + .id = 3, + .attributes = + { + ATTR_UINT32(MF_SD_MUTUALLY_EXCLUSIVE, 1, .todo = TRUE), + }, + }, + }, }; #undef ATTR_WSTR_OR_NONE