gtreshchev / RuntimeAudioImporter

Runtime Audio Importer plugin for Unreal Engine. Importing audio of various formats at runtime.
MIT License
336 stars 69 forks source link

Crash in Packaged build... binding Audio Finished function causes issue regarding GameThread #29

Closed jordaneast1 closed 1 year ago

jordaneast1 commented 1 year ago

hello! I posted this question on your marketplace page but I thought i would ask here too as it's a bit of a time sensitive job for a client.

I've got an issue, I seem to be getting a crash in the Packaged version of my game. I'm trying to bind an event callback to On Audio Playback Finished, which calls a Event Dispatch function (see graph).

Screenshot 2022-11-16 172808

This function calls back to various blueprints that may have activated the runtime audio to play. I'm binding / unbinding the callback a few times depending on which blueprint is calling the function. This all works great in PIE but it crashes in a Packaged game. so bit of an issue as we are delivering soon

Seems to be an issue related to the callback not being on GameThread. Any ideas on how to fix this would be much appreciated, I'm not much of a C++ guy! Or if you can see an issue in my blueprint i would also love to hear your thoughts.

this is the error in the crash stack

LogPlayLevel: Warning: [2022.11.16-06.07.07:487][390]LogRuntimeAudioImporter: Warning: Playback of the sound wave 'ImportedSoundWave_2147481809' has been completed LogPlayLevel: Warning: [2022.11.16-06.07.07:487][390]LogOutputDevice: Warning: LogPlayLevel: Script Stack (7 frames): LogPlayLevel: SFX_FunctionLibrary_C.Play Close Sound LogPlayLevel: BP_Activator_C.ExecuteUbergraph_BP_Activator LogPlayLevel: BP_Activator_C.CallDone LogPlayLevel: BP_VoiceOverPlayer_C.ExecuteUbergraph_BP_VoiceOverPlayer LogPlayLevel: BP_VoiceOverPlayer_C.VoiceOverDone LogPlayLevel: BP_VoiceOverController_C.ExecuteUbergraph_BP_VoiceOverController LogPlayLevel: BP_VoiceOverController_C.Audio Finished LogPlayLevel: [2022.11.16-06.07.23:948][390]LogAudioMixer: Display: Audio Buffer Underrun (starvation) detected. InstanceID=1 LogPlayLevel: Error: [2022.11.16-06.07.23:949][390]LogThreadingWindows: Error: Runnable thread Foreground Worker #0 crashed. LogPlayLevel: Error: [2022.11.16-06.07.23:949][390]LogWindows: Error: begin: stack for UAT LogPlayLevel: Error: [2022.11.16-06.07.23:949][390]LogWindows: Error: === Critical error: === LogPlayLevel: Error: [2022.11.16-06.07.23:949][390]LogWindows: Error: LogPlayLevel: Error: [2022.11.16-06.07.23:949][390]LogWindows: Error: Assertion failed: IsInGameThread() [File:D:\build++UE5\Sync\Engine\Source\Runtime\Engine\Private\AudioDevice.cpp] [Line: 6092] LogPlayLevel: Error: [2022.11.16-06.07.23:949][390]LogWindows: Error: LogPlayLevel: Error: [2022.11.16-06.07.23:949][390]LogWindows: Error: LogPlayLevel: Error: [2022.11.16-06.07.23:949][390]LogWindows: Error: LogPlayLevel: Error: [2022.11.16-06.07.23:949][390]LogWindows: Error: [Callstack] 0x00007ff76db96b3d UE_SyngentaVR.exe!FAudioDevice::PlaySoundAtLocation() [] LogPlayLevel: Error: [2022.11.16-06.07.23:949][390]LogWindows: Error: LogPlayLevel: Error: [2022.11.16-06.07.23:949][390]LogWindows: Error: Crash in runnable thread Foreground Worker #0 LogPlayLevel: Error: [2022.11.16-06.07.23:949][390]LogWindows: Error: end: stack for UAT LogPlayLevel: Error: ERROR: Client exited with error code: 3

any help is much appreciated! thanks

gtreshchev commented 1 year ago

Should be fixed in https://github.com/gtreshchev/RuntimeAudioImporter/commit/915c1a001b1183ed71d2e88c357d5d3b7a627c4f