Nikolay Sivov : mfplat/mediatype: Do not add user data when converting from WAVE_FORMAT_EXTENSIBLE.

Alexandre Julliard julliard at winehq.org
Tue Dec 1 15:40:34 CST 2020


Module: wine
Branch: master
Commit: 940adfdd56607cfd191baca815d9057b4915006f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=940adfdd56607cfd191baca815d9057b4915006f

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Dec  1 15:16:24 2020 +0300

mfplat/mediatype: Do not add user data when converting from WAVE_FORMAT_EXTENSIBLE.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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);
     }
 




More information about the wine-cvs mailing list