Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/mixer.c | 4 ++-- dlls/evr/tests/evr.c | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c index ba4624e0f51..554fb0725e8 100644 --- a/dlls/evr/mixer.c +++ b/dlls/evr/mixer.c @@ -603,8 +603,8 @@ static HRESULT WINAPI video_mixer_transform_GetOutputAvailableType(IMFTransform hr = MF_E_NO_MORE_TYPES; else { - *type = mixer->output.rt_formats[index].media_type; - IMFMediaType_AddRef(*type); + if (SUCCEEDED(hr = MFCreateMediaType(type))) + hr = IMFMediaType_CopyAllItems(mixer->output.rt_formats[index].media_type, (IMFAttributes *)*type); }
LeaveCriticalSection(&mixer->cs); diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index 2643f6ee92a..dd38a75ca2b 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -1045,9 +1045,11 @@ static void test_default_mixer_type_negotiation(void) while (SUCCEEDED(IMFTransform_GetOutputAvailableType(transform, 0, index++, &media_type))) { UINT64 frame_size; - GUID subtype; + GUID subtype, major; UINT32 value;
+ hr = IMFMediaType_GetGUID(media_type, &MF_MT_MAJOR_TYPE, &major); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); hr = IMFMediaType_GetGUID(media_type, &MF_MT_SUBTYPE, &subtype); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); hr = IMFMediaType_GetUINT64(media_type, &MF_MT_FRAME_SIZE, &frame_size); @@ -1059,6 +1061,15 @@ static void test_default_mixer_type_negotiation(void) } ok(index > 1, "Unexpected number of available types.\n");
+ /* Cloned type is returned. */ + hr = IMFTransform_GetOutputAvailableType(transform, 0, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMFTransform_GetOutputAvailableType(transform, 0, 0, &media_type2); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(media_type != media_type2, "Unexpected media type instance.\n"); + IMFMediaType_Release(media_type); + IMFMediaType_Release(media_type2); + hr = IMFTransform_QueryInterface(transform, &IID_IMFVideoProcessor, (void **)&processor); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);