mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 20:23:39 +00:00
mfmediaengine/tests: Make effect tests more consistent.
Do this by waiting for the first available frame with a separate ready event and removing flaky ref checks. Signed-off-by: Bernhard Kölbl <bkoelbl@codeweavers.com>
This commit is contained in:
parent
5590294cf3
commit
d19af88f59
|
@ -1139,7 +1139,7 @@ struct test_transfer_notify
|
||||||
LONG refcount;
|
LONG refcount;
|
||||||
|
|
||||||
IMFMediaEngineEx *media_engine;
|
IMFMediaEngineEx *media_engine;
|
||||||
HANDLE ready_event;
|
HANDLE ready_event, frame_ready_event;
|
||||||
HRESULT error;
|
HRESULT error;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1175,6 +1175,7 @@ static ULONG WINAPI test_transfer_notify_Release(IMFMediaEngineNotify *iface)
|
||||||
|
|
||||||
if (!refcount)
|
if (!refcount)
|
||||||
{
|
{
|
||||||
|
CloseHandle(notify->frame_ready_event);
|
||||||
CloseHandle(notify->ready_event);
|
CloseHandle(notify->ready_event);
|
||||||
free(notify);
|
free(notify);
|
||||||
}
|
}
|
||||||
|
@ -1211,6 +1212,8 @@ static HRESULT WINAPI test_transfer_notify_EventNotify(IMFMediaEngineNotify *ifa
|
||||||
notify->error = param2;
|
notify->error = param2;
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case MF_MEDIA_ENGINE_EVENT_FIRSTFRAMEREADY:
|
case MF_MEDIA_ENGINE_EVENT_FIRSTFRAMEREADY:
|
||||||
|
SetEvent(notify->frame_ready_event);
|
||||||
|
break;
|
||||||
case MF_MEDIA_ENGINE_EVENT_TIMEUPDATE:
|
case MF_MEDIA_ENGINE_EVENT_TIMEUPDATE:
|
||||||
SetEvent(notify->ready_event);
|
SetEvent(notify->ready_event);
|
||||||
break;
|
break;
|
||||||
|
@ -1237,6 +1240,9 @@ static struct test_transfer_notify *create_transfer_notify(void)
|
||||||
object->ready_event = CreateEventW(NULL, FALSE, FALSE, NULL);
|
object->ready_event = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||||
ok(!!object->ready_event, "Failed to create an event, error %lu.\n", GetLastError());
|
ok(!!object->ready_event, "Failed to create an event, error %lu.\n", GetLastError());
|
||||||
|
|
||||||
|
object->frame_ready_event = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||||
|
ok(!!object->frame_ready_event, "Failed to create an event, error %lu.\n", GetLastError());
|
||||||
|
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1295,7 +1301,7 @@ static void test_TransferVideoFrame(void)
|
||||||
SysFreeString(url);
|
SysFreeString(url);
|
||||||
IMFByteStream_Release(stream);
|
IMFByteStream_Release(stream);
|
||||||
|
|
||||||
res = WaitForSingleObject(notify->ready_event, 5000);
|
res = WaitForSingleObject(notify->frame_ready_event, 5000);
|
||||||
ok(!res, "Unexpected res %#lx.\n", res);
|
ok(!res, "Unexpected res %#lx.\n", res);
|
||||||
|
|
||||||
if (FAILED(notify->error))
|
if (FAILED(notify->error))
|
||||||
|
@ -1787,7 +1793,6 @@ static void test_effect(void)
|
||||||
UINT token;
|
UINT token;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
DWORD res;
|
DWORD res;
|
||||||
ULONG ref;
|
|
||||||
BSTR url;
|
BSTR url;
|
||||||
|
|
||||||
stream = load_resource(L"i420-64x64.avi", L"video/avi");
|
stream = load_resource(L"i420-64x64.avi", L"video/avi");
|
||||||
|
@ -1858,14 +1863,9 @@ static void test_effect(void)
|
||||||
IMFByteStream_Release(stream);
|
IMFByteStream_Release(stream);
|
||||||
|
|
||||||
/* Wait for MediaEngine to be ready. */
|
/* Wait for MediaEngine to be ready. */
|
||||||
res = WaitForSingleObject(notify->ready_event, 5000);
|
res = WaitForSingleObject(notify->frame_ready_event, 5000);
|
||||||
ok(!res, "Unexpected res %#lx.\n", res);
|
ok(!res, "Unexpected res %#lx.\n", res);
|
||||||
|
|
||||||
/* Wait for another update. This makes MediaEngine shutdown more consistent on Windows. */
|
|
||||||
res = WaitForSingleObject(notify->ready_event, 500);
|
|
||||||
/* Timeupdates are missing in Wine. */
|
|
||||||
todo_wine ok(!res, "Unexpected res %#lx.\n", res);
|
|
||||||
|
|
||||||
SetRect(&dst_rect, 0, 0, desc.Width, desc.Height);
|
SetRect(&dst_rect, 0, 0, desc.Width, desc.Height);
|
||||||
hr = IMFMediaEngineEx_TransferVideoFrame(notify->media_engine, (IUnknown *)texture, NULL, &dst_rect, NULL);
|
hr = IMFMediaEngineEx_TransferVideoFrame(notify->media_engine, (IUnknown *)texture, NULL, &dst_rect, NULL);
|
||||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||||
|
@ -1890,9 +1890,7 @@ done:
|
||||||
if (media_engine_ex)
|
if (media_engine_ex)
|
||||||
{
|
{
|
||||||
IMFMediaEngineEx_Shutdown(media_engine_ex);
|
IMFMediaEngineEx_Shutdown(media_engine_ex);
|
||||||
|
IMFMediaEngineEx_Release(media_engine_ex);
|
||||||
ref = IMFMediaEngineEx_Release(media_engine_ex);
|
|
||||||
todo_wine ok(!ref, "Unexpected ref %lu.\n", ref);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texture)
|
if (texture)
|
||||||
|
@ -1901,26 +1899,14 @@ done:
|
||||||
ID3D11Device_Release(device);
|
ID3D11Device_Release(device);
|
||||||
|
|
||||||
if (audio_effect2)
|
if (audio_effect2)
|
||||||
{
|
IMFTransform_Release(&audio_effect2->IMFTransform_iface);
|
||||||
ref = IMFTransform_Release(&audio_effect2->IMFTransform_iface);
|
|
||||||
todo_wine ok(!ref, "Unexpected ref %lu.\n", ref);
|
|
||||||
}
|
|
||||||
if (audio_effect)
|
if (audio_effect)
|
||||||
{
|
IMFTransform_Release(&audio_effect->IMFTransform_iface);
|
||||||
ref = IMFTransform_Release(&audio_effect->IMFTransform_iface);
|
|
||||||
todo_wine ok(!ref, "Unexpected ref %lu.\n", ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (video_effect2)
|
if (video_effect2)
|
||||||
{
|
IMFTransform_Release(&video_effect2->IMFTransform_iface);
|
||||||
ref = IMFTransform_Release(&video_effect2->IMFTransform_iface);
|
|
||||||
todo_wine ok(!ref, "Unexpected ref %lu.\n", ref);
|
|
||||||
}
|
|
||||||
if (video_effect)
|
if (video_effect)
|
||||||
{
|
IMFTransform_Release(&video_effect->IMFTransform_iface);
|
||||||
ref = IMFTransform_Release(&video_effect->IMFTransform_iface);
|
|
||||||
todo_wine ok(!ref, "Unexpected ref %lu.\n", ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
IMFMediaEngineNotify_Release(¬ify->IMFMediaEngineNotify_iface);
|
IMFMediaEngineNotify_Release(¬ify->IMFMediaEngineNotify_iface);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue