Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a rare crash when reading MP3 files #72

Open
yui-3 opened this issue Jul 14, 2024 · 3 comments
Open

a rare crash when reading MP3 files #72

yui-3 opened this issue Jul 14, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@yui-3
Copy link

yui-3 commented Jul 14, 2024

image

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.

@gtreshchev gtreshchev added the bug Something isn't working label Jul 14, 2024
@gtreshchev
Copy link
Owner

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?

@yui-3
Copy link
Author

yui-3 commented Aug 11, 2024

image
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

gtreshchev added a commit that referenced this issue Aug 11, 2024
@gtreshchev
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants