superpoweredSDK / Low-Latency-Android-iOS-Linux-Windows-tvOS-macOS-Interactive-Audio-Platform

🇸Superpowered Audio, Networking and Cryptographics SDKs. High performance and cross platform on Android, iOS, macOS, tvOS, Linux, Windows and modern web browsers.
https://superpowered.com
1.32k stars 284 forks source link

Android openPCM16AudioInMemory #736

Open asacque opened 1 year ago

asacque commented 1 year ago

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: AAudio1 >>> 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 (SEGVMAPERR), 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

ivannador commented 1 year ago

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 commented 1 year ago

Closing issue, will fix in future version.

asacque commented 1 year ago

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!

renezuidhof commented 7 months ago

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?

balazsbanto commented 5 months ago

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

Jbaxter03261982 commented 5 months ago

android:allowNativeHeapPointerTagging