Low-Latency-Android-iOS-Linux-Windows-tvOS-macOS-Interactive-Audio-Platform icon indicating copy to clipboard operation
Low-Latency-Android-iOS-Linux-Windows-tvOS-macOS-Interactive-Audio-Platform copied to clipboard

Android openPCM16AudioInMemory

Open asacque opened this issue 3 years ago • 6 comments

I make extensive use of openPCM16AudioInMemory for AdvancedAudioPlayer in my app and everything goes fine. But this is true only if I set targetSdkVersion 29 (ver.10) in build.gradle. As soon I set it at 30 (ver.11), or higher, this is what happens:

Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x28 in tid 7620 (AAudio_1), pid 7564 (mant.yyy) pid: 7564, tid: 7620, name: AAudio_1 >>> com.xxx.yyy <<< ../lib/arm64/libSPAudioEngine.so (Superpowered::bufferList::update()+40) ../lib/arm64/libSPAudioEngine.so (Superpowered::memoryPcmProvider::hasResponse()+92) ../lib/arm64/libSPAudioEngine.so (Superpowered::playerProcess::processAUTHREAD(float**, bool, unsigned int, float*, ...)+1704) ../lib/arm64/libSPAudioEngine.so (Superpowered::AdvancedAudioPlayer::processStereo(float*, bool, unsigned int, float)+72) ../lib/arm64/libSPAudioEngine.so (SampleTrack::process(float*, float, unsigned int)+124) ../lib/arm64/libSPAudioEngine.so (SPAudioEngine::process(short*, unsigned int)+300)

all this with SDK 2.5.0, but tried with 2.6.0 it's the same. Moreover, I use #define USE_AAUDIO 1 in SuperpoweredAndroidAudioIO.cpp, to get the least latency, but also because if I set it to 0 it gives:

Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x2f7365722f6b70 in tid 8904 (AudioTrack), pid 8867 (mant.yyy) pid: 8867, tid: 8904, name: AudioTrack >>> com.xxx.yyy<<<

at the launch, and the app doesn't even get started.

Any clue? Thanx in advance

asacque avatar Dec 05 '22 16:12 asacque

Thank you for reaching out!

We were able to reproduce the issue. The SuperpoweredPlayer sample app indeed crashes when using openPCM16AudioInMemory. While the issue gets resolved, as a workaround we recommend using the other open methods of the AdvancedAudioPlayer using the file path:

void open(const char *path, Superpowered::httpRequest *customHTTPRequest = 0, bool skipSilenceAtBeginning = false, bool measureSilenceAtEnd = false);

or

void open(const char *path, int offset, int length, Superpowered::httpRequest *customHTTPRequest = 0, bool skipSilenceAtBeginning = false, bool measureSilenceAtEnd = false);

ivannador avatar Dec 07 '22 09:12 ivannador

Closing issue, will fix in future version.

ivannador avatar Dec 07 '22 10:12 ivannador

Thank you so much for the rapid answer! Although the workaround could not fit my specific use case (I'm implementing a looper, and saving the real time audio input in a file to be opened, in real time, through the path could be not suitable) I'm happy to know that the issue will be fixed in a future release! Thanx again!

asacque avatar Dec 07 '22 10:12 asacque

I'm also running into this issue when using audioPlayer.openPCM16AudioInMemory. As a workaround I could set android:allowNativeHeapPointerTagging to false. I prefer not to though.

Any idea when this will be fixed?

renezuidhof avatar Nov 10 '23 00:11 renezuidhof

Yes, setting android:allowNativeHeapPointerTagging to false is a workaround. We are planning to release a fix soon.

balazsbanto avatar Jan 08 '24 10:01 balazsbanto

android:allowNativeHeapPointerTagging

Jbaxter03261982 avatar Jan 08 '24 10:01 Jbaxter03261982