Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
140 stars 2 forks source link

Importing an audio file that is an invalid combination of audio stream codec (Ex: AAC) and container (Ex: WAV) causes every user in current world to crash (access violation in mfplat.dll) #3167

Closed Ceekur closed 1 week ago

Ceekur commented 1 week ago

Describe the bug?

If a user in a world attempts to import an audio file that has an invalid combination of audio stream codec and audio container, this immediately causes every user in that current world to crash with a Unity error box. The crash log generated cites an exception in mfplat.dll. This appears to occur regardless of drag-and-drop or clicking on the file within the dash file browser. This happens in both screen and VR mode, as well as to every user even if they are tabbed out from the world.

There are likely more invalid combinations, but one tested combination is AAC with WAV.

If the world was on a headless, the world appears to stay open, but it immediately crashes most users who try to (re)join it, with the same error as if they were present during initial import. Even when someone does make it back in and remove the audio widget and traces of the upload attempt, the world can basically be considered un-joinable and must be restarted.

Of course, this combination of a file is bizarre to begin with and most programs that export A/V files usually prevent the user from creating such files. Nonetheless there are programs, even simple open source ones, that have very loose export options and will allow such combinations to be selected and exported into a resultant file.

To Reproduce

Create an audio file encoded in AAC in a WAV container (must be the actual container and not just a renamed extension) Import audio file

Expected behavior

Audio widget appears that is blank and has no playable audio, but no exception or interruption occurs.

Screenshots

No response

Resonite Version Number

Beta 2024.10.29.1229

What Platforms does this occur on?

Windows

What headset if any do you use?

Index

Log Files

error.log Player.log DESKTOP-AC9B6AO - 2024.10.29.1229 - 2024-11-10 22_35_10.log

Additional Context

No response

Reporters

Ceekur Waterfox AppleButter180

troyBORG commented 1 week ago

Can confirm this crashes the game with a Unity Crash..

I just took FFmpeg and encode some randon audio as AAC but told it to output as .wav file.

DESKTOP-H0FLKOJ - 2024.10.29.1229 - 2024-11-11 12_14_04.log

Frooxius commented 1 week ago

1) Can you provide us with a sample of such file for testing please? 2) When you import this, is it importing as an audio clip player or video clip player?

Ceekur commented 1 week ago

AAC_as_wav.zip Github is saying .wav file attachments are not allowed, so I quickly put it into a zip binary instead. It appears as a blanked audio clip player, in the very short time before the crash happens.

Frooxius commented 1 week ago

Sweet thank you!

Frooxius commented 1 week ago

Ok, so it turns out, this actually isn't an invalid combination - you can have AAC stream inside a WAV container. The CSCore library we use has handling for it and will initialize AAC decoder.

However problem there is, the AAC encoder uses Media Foundation (mfplat.dll), but there's likely some issue with the implementation (or possibly combination with Unity) of this, that causes corruption of the process.

I'll likely just block any Media Foundation decoders from working in the first place, since those aren't multi-platform in the first place, which should prevent the crash. It means that the files won't unfortunately decode, at least until we switch to another solution.

Frooxius commented 1 week ago

Fixed this in 2024.11.12.1329, thanks for the report!

These audio files will not work now, we do not support AAC for audio clips at the moment, but it will also prevent everyone from crashing.