[PATCH v3 5/5] winegstreamer: Enforce frame size in H264 decoder SetOutputType.
Rémi Bernon
wine at gitlab.winehq.org
Thu Jun 2 01:31:35 CDT 2022
From: Rémi Bernon <rbernon at codeweavers.com>
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/mf/tests/mf.c | 1 -
dlls/winegstreamer/h264_decoder.c | 6 ++++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index 4f55a67f30b..03035aa5e9f 100644
--- a/dlls/mf/tests/mf.c
+++ b/dlls/mf/tests/mf.c
@@ -7311,7 +7311,6 @@ static void test_h264_decoder(void)
ok(hr == S_OK, "MFCreateMediaType returned %#lx\n", hr);
init_media_type(media_type, is_win7 ? output_type_desc_win7 : output_type_desc, -1);
hr = IMFTransform_SetOutputType(transform, 0, media_type, 0);
- todo_wine
ok(hr == MF_E_INVALIDMEDIATYPE, "SetOutputType returned %#lx.\n", hr);
init_media_type(media_type, is_win7 ? new_output_type_desc_win7 : new_output_type_desc, -1);
hr = IMFTransform_SetOutputType(transform, 0, media_type, 0);
diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c
index e39b9340be1..19a36a9a77a 100644
--- a/dlls/winegstreamer/h264_decoder.c
+++ b/dlls/winegstreamer/h264_decoder.c
@@ -433,6 +433,7 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF
{
struct h264_decoder *decoder = impl_from_IMFTransform(iface);
GUID major, subtype;
+ UINT64 frame_size;
HRESULT hr;
ULONG i;
@@ -454,6 +455,11 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF
if (i == ARRAY_SIZE(h264_decoder_output_types))
return MF_E_INVALIDMEDIATYPE;
+ if (FAILED(hr = IMFMediaType_GetUINT64(type, &MF_MT_FRAME_SIZE, &frame_size))
+ || (frame_size >> 32) != decoder->wg_format.u.video.width
+ || (UINT32)frame_size != decoder->wg_format.u.video.height)
+ return MF_E_INVALIDMEDIATYPE;
+
if (decoder->output_type)
IMFMediaType_Release(decoder->output_type);
IMFMediaType_AddRef((decoder->output_type = type));
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/139
More information about the wine-devel
mailing list