1
0
mirror of https://github.com/wine-mirror/wine synced 2024-06-29 06:14:34 +00:00

mplat/tests: Test Media Source is freed if immediately released.

Tests that the Media Source and its associated resources are freed if
Release is called immediately after creation. That is, without a call to either
Start or Shutdown.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56686
This commit is contained in:
Brendan McGrath 2024-05-17 15:27:23 +10:00 committed by Alexandre Julliard
parent f0e77b163d
commit ac32d3fd72

View File

@ -966,6 +966,7 @@ static void test_source_resolver(void)
GUID guid;
float rate;
UINT32 rotation;
ULONG refcount;
if (!pMFCreateSourceResolver)
{
@ -1045,12 +1046,6 @@ static void test_source_resolver(void)
hr = MFCreateFile(MF_ACCESSMODE_READ, MF_OPENMODE_FAIL_IF_NOT_EXIST, MF_FILEFLAGS_NONE, filename, &stream);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* Wrap ::Close to test when the media source calls it */
bytestream_vtbl_orig = stream->lpVtbl;
bytestream_vtbl_wrapper = *bytestream_vtbl_orig;
bytestream_vtbl_wrapper.Close = bytestream_wrapper_Close;
stream->lpVtbl = &bytestream_vtbl_wrapper;
hr = IMFByteStream_QueryInterface(stream, &IID_IMFAttributes, (void **)&attributes);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMFAttributes_SetString(attributes, &MF_BYTESTREAM_CONTENT_TYPE, L"video/mp4");
@ -1077,6 +1072,33 @@ static void test_source_resolver(void)
ok(mediasource != NULL, "got %p\n", mediasource);
ok(obj_type == MF_OBJECT_MEDIASOURCE, "got %d\n", obj_type);
refcount = IMFMediaSource_Release(mediasource);
todo_wine
ok(!refcount, "Unexpected refcount %ld\n", refcount);
IMFByteStream_Release(stream);
/* We have to create a new bytestream here, because all following
* calls to CreateObjectFromByteStream will fail. */
hr = MFCreateFile(MF_ACCESSMODE_READ, MF_OPENMODE_FAIL_IF_NOT_EXIST, MF_FILEFLAGS_NONE, filename, &stream);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* Wrap ::Close to test when the media source calls it */
bytestream_vtbl_orig = stream->lpVtbl;
bytestream_vtbl_wrapper = *bytestream_vtbl_orig;
bytestream_vtbl_wrapper.Close = bytestream_wrapper_Close;
stream->lpVtbl = &bytestream_vtbl_wrapper;
hr = IMFByteStream_QueryInterface(stream, &IID_IMFAttributes, (void **)&attributes);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMFAttributes_SetString(attributes, &MF_BYTESTREAM_CONTENT_TYPE, L"video/mp4");
ok(hr == S_OK, "Failed to set string value, hr %#lx.\n", hr);
IMFAttributes_Release(attributes);
hr = IMFSourceResolver_CreateObjectFromByteStream(resolver, stream, NULL, MF_RESOLUTION_MEDIASOURCE, NULL,
&obj_type, (IUnknown **)&mediasource);
ok(mediasource != NULL, "got %p\n", mediasource);
ok(obj_type == MF_OBJECT_MEDIASOURCE, "got %d\n", obj_type);
check_interface(mediasource, &IID_IMFGetService, TRUE);
check_service_interface(mediasource, &MF_RATE_CONTROL_SERVICE, &IID_IMFRateSupport, TRUE);