From: Conor McCarthy cmccarthy@codeweavers.com
--- dlls/mf/tests/mf.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index a02f2859f91..e12a389f95f 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -131,6 +131,21 @@ static void check_service_interface_(unsigned int line, void *iface_ptr, REFGUID IUnknown_Release(unk); }
+#define check_sample_delivery(a) check_sample_delivery_(__LINE__, a) +static void check_sample_delivery_(unsigned int line, HANDLE event) +{ + HRESULT hr; + UINT i; + + WaitForSingleObject(event, 0); + /* Get five samples since Wine's mf session implementation sends four requests initially. */ + for (i = 0; i < 5; ++i) + { + hr = WaitForSingleObject(event, 200); + ok_(__FILE__, line)(hr == WAIT_OBJECT_0, "%u: Unexpected hr %#lx.\n", i, hr); + } +} + static HWND create_window(void) { RECT r = {0, 0, 640, 480}; @@ -3042,6 +3057,12 @@ static HRESULT WINAPI test_grabber_callback_OnProcessSample(IMFSampleGrabberSink if (!grabber->ready_event) return E_NOTIMPL;
+ if (!grabber->done_event) + { + SetEvent(grabber->ready_event); + return S_OK; + } + sample = create_sample(buffer, sample_size); hr = IMFSample_SetSampleFlags(sample, sample_flags); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -6627,6 +6648,8 @@ static void test_media_session_Start(void) }
grabber_callback = impl_from_IMFSampleGrabberSinkCallback(create_test_grabber_callback()); + grabber_callback->ready_event = CreateEventW(NULL, FALSE, FALSE, NULL); + ok(!!grabber_callback->ready_event, "CreateEventW failed, error %lu\n", GetLastError()); hr = MFCreateMediaType(&output_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); init_media_type(output_type, video_rgb32_desc, -1); @@ -6664,6 +6687,7 @@ static void test_media_session_Start(void) hr = IMFPresentationClock_GetTime(presentation_clock, &time); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(llabs(time - 10000000) <= allowed_error, "Unexpected time %I64d.\n", time); + check_sample_delivery(grabber_callback->ready_event);
/* Seek to beyond duration */ propvar.vt = VT_I8; @@ -6694,6 +6718,8 @@ static void test_media_session_Start(void) hr = IMFPresentationClock_GetTime(presentation_clock, &time); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(llabs(time) <= allowed_error, "Unexpected time %I64d.\n", time); + todo_wine + check_sample_delivery(grabber_callback->ready_event);
/* Seek to 1s while in paused state */ hr = IMFMediaSession_Pause(session); @@ -6719,6 +6745,9 @@ static void test_media_session_Start(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(time > old_time, "Unexpected time %I64d.\n", time);
+ todo_wine + check_sample_delivery(grabber_callback->ready_event); + hr = IMFMediaSession_Stop(session); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaSession_Close(session); @@ -6761,6 +6790,8 @@ static void test_media_session_Start(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok((caps & MFMEDIASOURCE_CAN_SEEK) == 0, "Got unexpected caps %#lx.\n", caps); grabber_callback = impl_from_IMFSampleGrabberSinkCallback(create_test_grabber_callback()); + grabber_callback->ready_event = CreateEventW(NULL, FALSE, FALSE, NULL); + ok(!!grabber_callback->ready_event, "CreateEventW failed, error %lu\n", GetLastError()); hr = MFCreateMediaType(&output_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); init_media_type(output_type, video_rgb32_desc, -1); @@ -6792,6 +6823,8 @@ static void test_media_session_Start(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok((caps & MFSESSIONCAP_SEEK) == 0, "Got unexpected caps %#lx\n", caps);
+ check_sample_delivery(grabber_callback->ready_event); + /* Seek to 1s */ propvar.vt = VT_I8; propvar.hVal.QuadPart = 10000000;