diff --git a/patches/mfplat-streaming-support/0052-winegstreamer-Force-audio-mpeg-to-decode-in-source.patch b/patches/mfplat-streaming-support/0052-winegstreamer-Force-audio-mpeg-to-decode-in-source.patch new file mode 100644 index 00000000..dfce3e82 --- /dev/null +++ b/patches/mfplat-streaming-support/0052-winegstreamer-Force-audio-mpeg-to-decode-in-source.patch @@ -0,0 +1,135 @@ +From 94a318fdf7083bcb8142a7b869ce9de1f9e1b0a3 Mon Sep 17 00:00:00 2001 +From: Thomas Crider +Date: Fri, 18 Dec 2020 14:01:29 -0500 +Subject: [PATCH] winegstreamer: Force audio/mpeg to decode in source + +Currently AAC audio does not transform correctly when done manually, however forcing mfplat +to perform the decode in source via MF_DECODE_IN_SOURCE as it does with raw audio works properly. + +Fixes various game audio freezes/hangs including Borderlands 3, Seven: Enhanced Edition +--- + dlls/winegstreamer/mfplat.c | 101 +----------------------------------- + 1 file changed, 1 insertion(+), 100 deletions(-) + +diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c +index e77c1d49e9a..ce0766beb12 100644 +--- a/dlls/winegstreamer/mfplat.c ++++ b/dlls/winegstreamer/mfplat.c +@@ -967,7 +967,7 @@ IMFMediaType *mf_media_type_from_caps(const GstCaps *caps) + if (gst_structure_get_int(info, "bitrate", &bitrate)) + IMFMediaType_SetUINT32(media_type, &MF_MT_AVG_BITRATE, bitrate); + +- if (!strcmp(mime_type, "audio/x-raw")) ++ if (!strcmp(mime_type, "audio/x-raw") || !(strcmp(mime_type, "audio/mpeg"))) + { + GstAudioInfo audio_info; + DWORD depth; +@@ -1008,105 +1008,6 @@ IMFMediaType *mf_media_type_from_caps(const GstCaps *caps) + + IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_BITS_PER_SAMPLE, depth); + } +- else if (!(strcmp(mime_type, "audio/mpeg"))) +- { +- int mpeg_version = -1; +- +- IMFMediaType_SetUINT32(media_type, &MF_MT_COMPRESSED, TRUE); +- +- if (!(gst_structure_get_int(info, "mpegversion", &mpeg_version))) +- ERR("Failed to get mpegversion\n"); +- switch (mpeg_version) +- { +- case 2: +- case 4: +- { +- const char *format, *profile, *level; +- DWORD profile_level_indication = 0; +- const GValue *codec_data; +- DWORD asc_size = 0; +- struct aac_user_data *user_data = NULL; +- +- IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &MFAudioFormat_AAC); +- IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_BITS_PER_SAMPLE, 16); +- +- codec_data = gst_structure_get_value(info, "codec_data"); +- if (codec_data) +- { +- GstBuffer *codec_data_buffer = gst_value_get_buffer(codec_data); +- if (codec_data_buffer) +- { +- if ((asc_size = gst_buffer_get_size(codec_data_buffer)) >= 2) +- { +- user_data = heap_alloc_zero(sizeof(*user_data)+asc_size); +- gst_buffer_extract(codec_data_buffer, 0, (gpointer)(user_data + 1), asc_size); +- } +- else +- ERR("Unexpected buffer size\n"); +- } +- else +- ERR("codec_data not a buffer\n"); +- } +- else +- ERR("codec_data not found\n"); +- if (!user_data) +- user_data = heap_alloc_zero(sizeof(*user_data)); +- +- if ((format = gst_structure_get_string(info, "stream-format"))) +- { +- DWORD payload_type = -1; +- if (!(strcmp(format, "raw"))) +- payload_type = 0; +- else if (!(strcmp(format, "adts"))) +- payload_type = 1; +- else if (!(strcmp(format, "adif"))) +- payload_type = 2; +- else if (!(strcmp(format, "loas"))) +- payload_type = 3; +- else +- FIXME("Unrecognized stream-format\n"); +- if (payload_type != -1) +- { +- IMFMediaType_SetUINT32(media_type, &MF_MT_AAC_PAYLOAD_TYPE, payload_type); +- user_data->payload_type = payload_type; +- } +- } +- else +- { +- ERR("Stream format not present\n"); +- } +- +- profile = gst_structure_get_string(info, "profile"); +- level = gst_structure_get_string(info, "level"); +- /* Data from http://archive.is/whp6P#45% */ +- if (profile && level) +- { +- if (!(strcmp(profile, "lc")) && !(strcmp(level, "2"))) +- profile_level_indication = 0x29; +- else if (!(strcmp(profile, "lc")) && !(strcmp(level, "4"))) +- profile_level_indication = 0x2A; +- else if (!(strcmp(profile, "lc")) && !(strcmp(level, "5"))) +- profile_level_indication = 0x2B; +- else +- FIXME("Unhandled profile/level combo\n"); +- } +- else +- ERR("Profile or level not present\n"); +- +- if (profile_level_indication) +- { +- IMFMediaType_SetUINT32(media_type, &MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION, profile_level_indication); +- user_data->profile_level_indication = profile_level_indication; +- } +- +- IMFMediaType_SetBlob(media_type, &MF_MT_USER_DATA, (BYTE *)user_data, sizeof(*user_data) + asc_size); +- heap_free(user_data); +- break; +- } +- default: +- FIXME("Unhandled mpegversion %d\n", mpeg_version); +- } +- } + else if (!(strcmp(mime_type, "audio/x-wma"))) + { + gint wma_version, block_align; +-- +2.29.2 + diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 3d078c3f..8a8915b3 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "0aa6f8e2ea1e3f2e852bef1a07d0d1f983870150" + echo "56e7cd12ce0ce3bb331a8595b25aedb811b79110" } # Show version information @@ -2949,6 +2949,7 @@ if test "$enable_mfplat_streaming_support" -eq 1; then patch_apply mfplat-streaming-support/0049-Revert-Improve-tests.patch patch_apply mfplat-streaming-support/0050-winegstreamer-Introduce-MPEG-4-Section-2-video-decod.patch patch_apply mfplat-streaming-support/0051-winegstreamer-Introduce-WMA-audio-decoder.patch + patch_apply mfplat-streaming-support/0052-winegstreamer-Force-audio-mpeg-to-decode-in-source.patch patch_apply mfplat-streaming-support/0060-winegstreamer-Support-eAVEncH264VProfile_Constrained.patch fi