Fixes Gungrave G.o.r.e media playback and hang on start.
I tested separately that setting an obviously invalid AudioSpecificConfig fails on Windows as well. On Windows stream attributes incompatible with AudioSpecificConfig (e. g., sample rate) also fails. We currently don't have such checks (and that will require fully parsing AudioSpecificConfig on our side), but since we don't have to choose between the parameters and only validate them I hope missing validation is not critical until we have something depending on that.
From: Paul Gofman pgofman@codeweavers.com
--- dlls/winegstreamer/aac_decoder.c | 2 -- dlls/winegstreamer/gst_private.h | 2 ++ dlls/winegstreamer/mfplat.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/winegstreamer/aac_decoder.c b/dlls/winegstreamer/aac_decoder.c index 8366ac7bb36..d79ede69c9d 100644 --- a/dlls/winegstreamer/aac_decoder.c +++ b/dlls/winegstreamer/aac_decoder.c @@ -30,8 +30,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(mfplat); WINE_DECLARE_DEBUG_CHANNEL(winediag);
-extern const GUID MFAudioFormat_RAW_AAC; - static struct { const GUID *const guid; diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 1e4aad32f44..5b4c01a3cd0 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -148,4 +148,6 @@ HRESULT aac_decoder_create(REFIID riid, void **ret); HRESULT h264_decoder_create(REFIID riid, void **ret); HRESULT video_processor_create(REFIID riid, void **ret);
+extern const GUID MFAudioFormat_RAW_AAC; + #endif /* __GST_PRIVATE_INCLUDED__ */ diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 34731a23e1e..032d352b7cc 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -863,7 +863,7 @@ void mf_media_type_to_wg_format(IMFMediaType *type, struct wg_format *format) IsEqualGUID(&subtype, &MFAudioFormat_WMAudioV9) || IsEqualGUID(&subtype, &MFAudioFormat_WMAudio_Lossless)) mf_media_type_to_wg_format_audio_wma(type, &subtype, format); - else if (IsEqualGUID(&subtype, &MFAudioFormat_AAC)) + else if (IsEqualGUID(&subtype, &MFAudioFormat_AAC) || IsEqualGUID(&subtype, &MFAudioFormat_RAW_AAC)) mf_media_type_to_wg_format_audio_mpeg4(type, format); else mf_media_type_to_wg_format_audio(type, &subtype, format);
From: Paul Gofman pgofman@codeweavers.com
--- dlls/winegstreamer/mfplat.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 032d352b7cc..d7c67de0fca 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -624,7 +624,7 @@ static void mf_media_type_to_wg_format_audio(IMFMediaType *type, const GUID *sub FIXME("Unrecognized audio subtype %s, depth %u.\n", debugstr_guid(subtype), depth); }
-static void mf_media_type_to_wg_format_audio_mpeg4(IMFMediaType *type, struct wg_format *format) +static void mf_media_type_to_wg_format_audio_mpeg4(IMFMediaType *type, const GUID *subtype, struct wg_format *format) { /* Audio specific config is stored at after HEAACWAVEINFO in MF_MT_USER_DATA * https://docs.microsoft.com/en-us/windows/win32/api/mmreg/ns-mmreg-heaacwavef... @@ -646,6 +646,7 @@ static void mf_media_type_to_wg_format_audio_mpeg4(IMFMediaType *type, struct wg BYTE buffer[64]; HEAACWAVEFORMAT *user_data = (HEAACWAVEFORMAT *)buffer; UINT32 codec_data_size; + BOOL raw_aac;
if (FAILED(IMFMediaType_GetBlob(type, &MF_MT_USER_DATA, buffer, sizeof(buffer), &codec_data_size))) { @@ -653,12 +654,18 @@ static void mf_media_type_to_wg_format_audio_mpeg4(IMFMediaType *type, struct wg return; }
- codec_data_size -= min(codec_data_size, offsetof(HEAACWAVEFORMAT, pbAudioSpecificConfig)); + raw_aac = IsEqualGUID(subtype, &MFAudioFormat_RAW_AAC); + if (!raw_aac) + codec_data_size -= min(codec_data_size, offsetof(HEAACWAVEFORMAT, pbAudioSpecificConfig)); if (codec_data_size > sizeof(format->u.audio_mpeg4.codec_data)) { FIXME("Codec data needs %u bytes.\n", codec_data_size); return; } + if (raw_aac) + memcpy(format->u.audio_mpeg4.codec_data, buffer, codec_data_size); + else + memcpy(format->u.audio_mpeg4.codec_data, user_data->pbAudioSpecificConfig, codec_data_size);
format->major_type = WG_MAJOR_TYPE_AUDIO_MPEG4;
@@ -666,7 +673,6 @@ static void mf_media_type_to_wg_format_audio_mpeg4(IMFMediaType *type, struct wg format->u.audio_mpeg4.payload_type = -1;
format->u.audio_mpeg4.codec_data_len = codec_data_size; - memcpy(format->u.audio_mpeg4.codec_data, user_data->pbAudioSpecificConfig, codec_data_size); }
static enum wg_video_format mf_video_format_to_wg(const GUID *subtype) @@ -864,7 +870,7 @@ void mf_media_type_to_wg_format(IMFMediaType *type, struct wg_format *format) IsEqualGUID(&subtype, &MFAudioFormat_WMAudio_Lossless)) mf_media_type_to_wg_format_audio_wma(type, &subtype, format); else if (IsEqualGUID(&subtype, &MFAudioFormat_AAC) || IsEqualGUID(&subtype, &MFAudioFormat_RAW_AAC)) - mf_media_type_to_wg_format_audio_mpeg4(type, format); + mf_media_type_to_wg_format_audio_mpeg4(type, &subtype, format); else mf_media_type_to_wg_format_audio(type, &subtype, format); }
From: Paul Gofman pgofman@codeweavers.com
--- dlls/winegstreamer/mfplat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index d7c67de0fca..4cd095fb82e 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -670,7 +670,7 @@ static void mf_media_type_to_wg_format_audio_mpeg4(IMFMediaType *type, const GUI format->major_type = WG_MAJOR_TYPE_AUDIO_MPEG4;
if (FAILED(IMFMediaType_GetUINT32(type, &MF_MT_AAC_PAYLOAD_TYPE, &format->u.audio_mpeg4.payload_type))) - format->u.audio_mpeg4.payload_type = -1; + format->u.audio_mpeg4.payload_type = 0;
format->u.audio_mpeg4.codec_data_len = codec_data_size; }
From: Paul Gofman pgofman@codeweavers.com
--- dlls/mf/tests/transform.c | 45 +++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 14 deletions(-)
diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index f1d7ffbc071..f806485df78 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -2223,7 +2223,7 @@ failed: CoUninitialize(); }
-static void test_aac_decoder(void) +static void test_aac_decoder_subtype(const struct attribute_desc *input_type_desc) { const GUID *const class_id = &CLSID_MSAACDecMFT; const struct transform_info expect_mft_info = @@ -2313,19 +2313,6 @@ static void test_aac_decoder(void) /* more AAC decoder specific attributes from CODECAPI */ {0}, }; - const struct attribute_desc input_type_desc[] = - { - ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio, .required = TRUE), - ATTR_GUID(MF_MT_SUBTYPE, MFAudioFormat_AAC, .required = TRUE), - ATTR_UINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, 44100, .required = TRUE), - ATTR_BLOB(MF_MT_USER_DATA, aac_codec_data, sizeof(aac_codec_data), .required = TRUE), - ATTR_UINT32(MF_MT_AUDIO_BITS_PER_SAMPLE, 16), - ATTR_UINT32(MF_MT_AUDIO_NUM_CHANNELS, 1), - ATTR_UINT32(MF_MT_AUDIO_AVG_BYTES_PER_SECOND, 12000), - ATTR_UINT32(MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION, 41), - ATTR_UINT32(MF_MT_AAC_PAYLOAD_TYPE, 0), - {0}, - }; static const struct attribute_desc output_type_desc[] = { ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio, .required = TRUE), @@ -2545,6 +2532,36 @@ failed: CoUninitialize(); }
+static void test_aac_decoder(void) +{ + static const BYTE aac_raw_codec_data[] = {0x12, 0x08}; + static const struct attribute_desc raw_aac_input_type_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio, .required = TRUE), + ATTR_GUID(MF_MT_SUBTYPE, MFAudioFormat_RAW_AAC1, .required = TRUE), + ATTR_UINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, 44100, .required = TRUE), + ATTR_UINT32(MF_MT_AUDIO_NUM_CHANNELS, 1), + ATTR_BLOB(MF_MT_USER_DATA, aac_raw_codec_data, sizeof(aac_raw_codec_data), .required = TRUE), + {0}, + }; + static const struct attribute_desc aac_input_type_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio, .required = TRUE), + ATTR_GUID(MF_MT_SUBTYPE, MFAudioFormat_AAC, .required = TRUE), + ATTR_UINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, 44100, .required = TRUE), + ATTR_BLOB(MF_MT_USER_DATA, aac_codec_data, sizeof(aac_codec_data), .required = TRUE), + ATTR_UINT32(MF_MT_AUDIO_BITS_PER_SAMPLE, 16), + ATTR_UINT32(MF_MT_AUDIO_NUM_CHANNELS, 1), + ATTR_UINT32(MF_MT_AUDIO_AVG_BYTES_PER_SECOND, 12000), + ATTR_UINT32(MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION, 41), + ATTR_UINT32(MF_MT_AAC_PAYLOAD_TYPE, 0), + {0}, + }; + + test_aac_decoder_subtype(aac_input_type_desc); + test_aac_decoder_subtype(raw_aac_input_type_desc); +} + static const BYTE wma_codec_data[10] = {0, 0x44, 0, 0, 0x17, 0, 0, 0, 0, 0}; static const ULONG wmaenc_block_size = 1487; static const ULONG wmadec_block_size = 0x2000;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=129393
Your paranoid android.
=== w7u_adm (32 bit report) ===
mf: transform.c:3827: Test failed: h264dec: invalid h264 length transform.c:3827: Test failed: h264dec: invalid h264 buffer
=== w864 (64 bit report) ===
mf: transform.c:3827: Test failed: h264dec: invalid h264 length transform.c:3827: Test failed: h264dec: invalid h264 buffer
=== debian11 (32 bit report) ===
winhttp: notification.c:118: Test failed: 1244: expected status 0x8 got 0x200000
This merge request was approved by Rémi Bernon.
This merge request was approved by Zebediah Figura.
This merge request was approved by Nikolay Sivov.