Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/mediatype.c | 7 ++++--- dlls/mfplat/tests/mfplat.c | 13 +++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index 893eb3e778..382f066327 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -514,13 +514,14 @@ static HRESULT WINAPI mediatype_IsEqual(IMFMediaType *iface, IMFMediaType *type, PropVariantInit(&right.value); right.hr = IMFAttributes_GetItem(right.type, &MF_MT_USER_DATA, &right.value);
- if (SUCCEEDED(left.hr) && SUCCEEDED(left.hr)) + /* Compare user data if both types have it, otherwise simply check if both don't. */ + if (SUCCEEDED(left.hr) && SUCCEEDED(right.hr)) { result = FALSE; IMFAttributes_CompareItem(left.type, &MF_MT_USER_DATA, &left.value, &result); } - else if (FAILED(left.hr) && FAILED(left.hr)) - result = TRUE; + else + result = FAILED(left.hr) && FAILED(right.hr);
PropVariantClear(&left.value); PropVariantClear(&right.value); diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 6800441ba2..896cd93a46 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -762,6 +762,19 @@ if(0) ok(flags == (MF_MEDIATYPE_EQUAL_MAJOR_TYPES | MF_MEDIATYPE_EQUAL_FORMAT_TYPES | MF_MEDIATYPE_EQUAL_FORMAT_DATA | MF_MEDIATYPE_EQUAL_FORMAT_USER_DATA), "Unexpected flags %#x.\n", flags);
+ /* Different user data. */ + hr = IMFMediaType_SetBlob(mediatype, &MF_MT_USER_DATA, (const UINT8 *)&flags, sizeof(flags)); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + + flags = 0; + hr = IMFMediaType_IsEqual(mediatype, mediatype2, &flags); + ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr); + ok(flags == (MF_MEDIATYPE_EQUAL_MAJOR_TYPES | MF_MEDIATYPE_EQUAL_FORMAT_TYPES | MF_MEDIATYPE_EQUAL_FORMAT_DATA), + "Unexpected flags %#x.\n", flags); + + hr = IMFMediaType_DeleteItem(mediatype, &MF_MT_USER_DATA); + ok(hr == S_OK, "Failed to delete item, hr %#x.\n", hr); + hr = IMFMediaType_SetGUID(mediatype, &MF_MT_SUBTYPE, &MFVideoFormat_RGB32); ok(hr == S_OK, "Failed to set subtype, hr %#x.\n", hr);