App Crash when loading and playing Ogg Vorbis from file (Not content)

Hello,

My app requires dynamic loading of audio data from the android filesystem and, based on the code provided here modified slightly. The app specifically crashes as soon as the loaded song is played. This code works fine when run directly in editor (Windows) and if there is no audio file to load (As it just quickly exits the play function and doesn’t care that no audio is playing). I believe that the issue is probably with the specific type of audio data (44100Hz 16 bit PCM Two channel audio saved via Audacity at quality level 5) and that OpenSL cannot handle it, although I have also tested with multiple free OGG files including the example file on the Vorbis Wikipedia page.

What follows is the Android log data specifically relating to the crash.



V/AudioTrack(16659): set(): streamType 3, sampleRate 44100, format 0x1, channelMask 0x3, frameCount 0, flags #4, notificationFrames 0, sessionId 237, transferType 0
V/AudioTrack(16659): set() streamType 3, sampleRate 44100, format 1, frameCount 0, flags 0004
I/AudioFlinger(  344): isAudioPlaybackHookOn() false
V/AudioPolicyManager(  344): getOutputForAttr() usage=1, content=2, tag= flags=00000000
V/AudioPolicyManager(  344): getOutputForAttr() device 2, samplingRate 44100, format 1, channelMask 3, flags 4
V/AudioPolicyManagerEx(  344): AudioPolicyManagerEx: getOutputForDevice
V/AudioPolicyManagerEx(  344): getOutput() returns output 2
V/AudioSystem(16659): getLatency() output 2, latency 50
V/AudioSystem(16659): getFrameCount() output 2, frameCount 960
W/AudioTrack(16659): AUDIO_OUTPUT_FLAG_FAST denied by client
V/AudioTrack(16659): createTrack_l() output 2 afLatency 50
V/AudioTrack(16659): afFrameCount=960, minBufCount=2, afSampleRate=48000, afLatency=50
V/AudioTrack(16659): minFrameCount: 2646, afFrameCount=960, minBufCount=3, sampleRate=44100, afSampleRate=48000, afLatency=50
V/AudioFlinger(  344): [MABL] createTrack() mPlaybackThreads.size: 2, MABLEn:0, MABLCur:31
V/AudioFlinger(  344): [MABL_AudioFlinger] PlaybackThread::setMABLEnable(), enable = 0 
V/AudioFlinger(  344): [MABL_AudioFlinger] PlaybackThread::setMABLControl(), curLvl = 31 
V/AudioFlinger(  344): [MABL] createTrack() mPlaybackThreads.size: 2, MABLEn:0, MABLCur:31
V/AudioFlinger(  344): [MABL_AudioFlinger] PlaybackThread::setMABLEnable(), enable = 0 
V/AudioFlinger(  344): [MABL_AudioFlinger] PlaybackThread::setMABLControl(), curLvl = 31 
V/AudioFlinger(  344): createTrack() lSessionId: 237
V/SoundNormalizerUtil(  344): lge.normalizer.param = version2.0/true/9.6/true/10500/0.8/5200/0.42
V/SoundNormalizerUtil(  344): SoundNormalizer:version = version2.0
V/SoundNormalizerUtil(  344): SoundNormalizer:Enable = "true"
V/SoundNormalizerUtil(  344): normalizer V2: SoundNormalizer:Enable set to true
V/SoundNormalizerUtil(  344): normalizer V2: normalizerMakeupGain = 9.6
V/SoundNormalizerUtil(  344): SoundNormalizer:PreFilter_HPF_350Hz = "true"
V/SoundNormalizerUtil(  344): normalizer V2: AudioEffect:SoundNormalizer:PreFilter_HPF_350Hz set to true
V/SoundNormalizerUtil(  344): normalizer V2: normalizerLimiterThreshold = 10500
V/SoundNormalizerUtil(  344): normalizer V2: normalizerLimiterSlope = 0.80
V/SoundNormalizerUtil(  344): normalizer V2: normalizerCompressorThreshold = 5200
V/SoundNormalizerUtil(  344): normalizer V2: normalizerCompressorSlope = 0.42
V/AudioFlinger(  344): acquiring 237 from 16659, for 16659
V/AudioFlinger(  344):  added new entry for 237
W/libOpenSLES(16659): Leaving BufferQueue::Enqueue (SL_RESULT_PARAMETER_INVALID)
D/UE4     (16659): Fatal error: [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.6\Engine\Source\Runtime\Android\AndroidAudio\Private\AndroidAudioSource.cpp] [Line: 130] 
D/UE4     (16659): FAILED OPENSL BUFFER Enqueue SL_PlayerBufferQueue 0x2 params( 0x0, 35610624)
D/UE4     (16659): [2015.01.19-00.57.15:173]  0]LogAndroidAudio:Fatal: FAILED OPENSL BUFFER Enqueue SL_PlayerBufferQueue 0x2 params( 0x0, 35610624)
I/art     (16659): System.exit called, status: 0
I/AndroidRuntime(16659): VM exiting with result code 0, cleanup skipped.
V/AudioFlinger(  344): 16659 died, releasing its sessions
V/AudioFlinger(  344):  pid 1983 @ 0
V/AudioFlinger(  344):  pid 3829 @ 1
V/AudioFlinger(  344):  pid 3829 @ 2
V/AudioFlinger(  344):  pid 4068 @ 3
V/AudioFlinger(  344):  pid 1072 @ 4
V/AudioFlinger(  344):  pid 1072 @ 5
V/AudioFlinger(  344):  pid 1072 @ 6
V/AudioFlinger(  344):  pid 16659 @ 7
V/AudioFlinger(  344):  removing entry for pid 16659 session 236
V/AudioFlinger(  344):  pid 16659 @ 7
V/AudioFlinger(  344):  removing entry for pid 16659 session 237
V/AudioFlinger(  344): purging stale effects
V/AudioPolicyService(  344): AudioCommandThread() adding release output 2
V/AudioPolicyService(  344): inserting command: 6 at index 0, num commands 0
I/WindowState( 1072): WIN DEATH: Window{3e575bd3 u0 com.epicgames.BeatVortex/com.epicgames.ue4.GameActivity}
W/InputDispatcher( 1072): channel '3e575bd3 com.epicgames.BeatVortex/com.epicgames.ue4.GameActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9


As you can see, the error occurs when OpenSL reports a SL_RESULT_PARAMETER_INVALID error, but I can’t seem to see any other glaringly obvious or otherwise helpful data about this message.

How would I go about fixing this (If possible). I’m fine with adjusting any of the properties of this OGG or switching to any of the other audio formats UE4 supports if there are issues with the audio file or how Android handles it. I’d be happy to provide any other data as required.

Thanks,

Edit:

Discovered that the function of the crash is the FSLESSoundSource::EnqueuePCMBuffer function in ‘/Source/Runtime/Android/AndroidAudio/Private/AndroidAudioSource.cpp’, specifically the call to (*SL_PlayerBufferQueue)->Enqueue and the corresponding fatal UE_LOG below it. Again, the result I’m getting is ‘SL_RESULT_PARAMETER_INVALID’ rather than the expected ‘SL_RESULT_SUCCESS’ but I can’t find much help with what or how the parameters are invalid or corrupt.

Could someone with any knowledge in the system provide any hints as to why this will fail that would be hugely appreciated, thanks!

Hi danm36,

Please post this to the bug reports section of the answerhub at http://answers.unrealengine.com so we can better assist you. You can find out more about how to report a bug here: How do I report a bug? - Programming & Scripting - Epic Developer Community Forums