From 940adfdd56607cfd191baca815d9057b4915006f Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 1 Dec 2020 15:16:24 +0300 Subject: [PATCH] mfplat/mediatype: Do not add user data when converting from WAVE_FORMAT_EXTENSIBLE. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mfplat/mediatype.c | 2 +- dlls/mfplat/tests/mfplat.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index 62d75e80146..2bf9b674ea7 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -3011,7 +3011,7 @@ HRESULT WINAPI MFInitMediaTypeFromWaveFormatEx(IMFMediaType *mediatype, const WA mediatype_set_uint32(mediatype, &MF_MT_ALL_SAMPLES_INDEPENDENT, 1, &hr); } - if (format->cbSize) + if (format->cbSize && format->wFormatTag != WAVE_FORMAT_EXTENSIBLE) mediatype_set_blob(mediatype, &MF_MT_USER_DATA, (const UINT8 *)(format + 1), format->cbSize, &hr); return hr; diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 38e8acb966e..b361d4da162 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -5625,9 +5625,13 @@ static void test_MFInitMediaTypeFromWaveFormatEx(void) waveformatext.dwChannelMask = 0x8; memcpy(&waveformatext.SubFormat, &MFAudioFormat_Base, sizeof(waveformatext.SubFormat)); waveformatext.SubFormat.Data1 = waveformatex_tests[i].wFormatTag; + hr = MFInitMediaTypeFromWaveFormatEx(mediatype, &waveformatext.Format, sizeof(waveformatext)); ok(hr == S_OK, "Failed to initialize media type, hr %#x.\n", hr); + hr = IMFMediaType_GetItem(mediatype, &MF_MT_USER_DATA, NULL); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#x.\n", hr); + validate_media_type(mediatype, &waveformatext.Format); }