winegstreamer: Reject incompatible input media types in MPEG layer-3 decoder.

Signed-off-by: Anton Baskanov <baskanov@gmail.com>
This commit is contained in:
Anton Baskanov 2022-10-02 19:40:06 +07:00 committed by Alexandre Julliard
parent fea3691aea
commit 4489c31b3d
2 changed files with 17 additions and 5 deletions

View file

@ -707,23 +707,23 @@ static void test_media_types(void)
ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IPin_QueryAccept(pin, &mp1_mt);
todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
hr = IPin_QueryAccept(pin, &mp2_mt);
todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
hr = IPin_QueryAccept(pin, &mp3_mt0);
todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
mt = mp3_mt1;
mt.majortype = GUID_NULL;
hr = IPin_QueryAccept(pin, &mt);
todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
mt = mp3_mt1;
mt.formattype = GUID_NULL;
hr = IPin_QueryAccept(pin, &mt);
todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
IPin_Release(pin);

View file

@ -737,6 +737,18 @@ HRESULT mpeg_audio_codec_create(IUnknown *outer, IUnknown **out)
static HRESULT mpeg_layer3_decoder_sink_query_accept(struct transform *filter, const AM_MEDIA_TYPE *mt)
{
const MPEGLAYER3WAVEFORMAT *format;
if (!IsEqualGUID(&mt->majortype, &MEDIATYPE_Audio)
|| !IsEqualGUID(&mt->formattype, &FORMAT_WaveFormatEx)
|| mt->cbFormat < sizeof(MPEGLAYER3WAVEFORMAT))
return S_FALSE;
format = (const MPEGLAYER3WAVEFORMAT *)mt->pbFormat;
if (format->wfx.wFormatTag != WAVE_FORMAT_MPEGLAYER3)
return S_FALSE;
return S_OK;
}