RuntimeAudioImporter
RuntimeAudioImporter copied to clipboard
a rare crash when reading MP3 files
the probability of crashing is low, and there is no particularly complex logic. It just reads the header information of several MP3 files.
[Inline Frame] MyProject-Win64-Shipping.exe!hdr_valid(const unsigned char *) Line 266 C++ MyProject-Win64-Shipping.exe!hdr_compare(const unsigned char * h1, const unsigned char * h2) Line 275 C++ [Inline Frame] MyProject-Win64-Shipping.exe!mp3d_match_frame(const unsigned char *) Line 1665 C++ MyProject-Win64-Shipping.exe!mp3d_find_frame(const unsigned char * mp3, int mp3_bytes, int * free_format_bytes, int * ptr_frame_bytes) Line 1695 C++ [Inline Frame] MyProject-Win64-Shipping.exe!mp3dec_detect_cb(mp3dec_io_t *) Line 277 C++ [Inline Frame] MyProject-Win64-Shipping.exe!mp3dec_detect_buf(const unsigned char *) Line 242 C++ MyProject-Win64-Shipping.exe!FMP3_RuntimeCodec::CheckAudioFormat(const FRuntimeBulkDataBuffer
& AudioData) Line 22 C++ [Inline Frame] MyProject-Win64-Shipping.exe!FRuntimeCodecFactory::GetCodecs(const FRuntimeBulkDataBuffer &) Line 64 C++ MyProject-Win64-Shipping.exe!URuntimeAudioUtilities::GetAudioHeaderInfoFromBuffer::__l2::<lambda_1>::operator()() Line 86 C++ [External Code] [Frames may be missing, no binary loaded for kernel32.dll] [External Code]
Unhandled exception at 0x00007FF6C1963F00 (MyProject-Win64-Shipping.exe) in UEMinidump.dmp: 0xC0000005: Access violation reading location 0x000002B733B00B40.
Hi, could you please ensure that the used objects, specifically the imported sound wave and runtime audio importer library, are represented in Blueprint variables or, if you're working in C++, are marked with UPROPERTY/any other strong references to prevent them from being garbage collected? Also, I’m wondering about the audio files you are using, could you please provide links to them, if possible?
Thanks for your reply,
I've changed my implementation. but at that time I was just calling this function in Blueprint, like the image. I have a UserWidget class for displaying audio information, which reads audio header information from a file during construction. When I have dozens of audio files, this is when the issue occurs.
and the audio files is here: https://drive.google.com/file/d/1n0MamZH-fhjPdOD7zhMihj9hLPPmgAD-/view?usp=drive_link
The issue might be related to checking all codecs directly by the buffer, with one of them failing and causing a crash for some reason, though I wasn't able to reproduce it. I've pushed a fix to also consider the path, specifically the extension of the file.
You might also try changing the default mp3 codec from minimp3 to dr_mp3 by setting bUseDrMp3 to true here: https://github.com/gtreshchev/RuntimeAudioImporter/blob/main/Source/RuntimeAudioImporter/RuntimeAudioImporter.Build.cs#L27