[PATCH 2/7] mfplat/mediatype: Do not add user data when converting from WAVE_FORMAT_EXTENSIBLE.
Nikolay Sivov
nsivov at codeweavers.com
Tue Dec 1 06:16:24 CST 2020
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
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);
}
--
2.29.2
More information about the wine-devel
mailing list