Skip to content

SIGSEGV Faults on Android when processing stereo #806

@flamewave000

Description

@flamewave000

Our player utilizes the below code to process the stereo based on the examples provided and the documentation of the processStereo method.

static bool audioProcessing(void * clientData, int16_t *audio, int32_t numberOfFrames, int32_t sampleRate) {
    auto player = static_cast<AudioProcessor *>(clientData)->player;
    if (player == nullptr) return false;
    float playerOutput[(numberOfFrames * (8 / sizeof(float))) + (64 / sizeof(float))];
    player->outputSamplerate = (uint32_t) sampleRate;
    if (player->processStereo(playerOutput, false, (uint32_t) numberOfFrames)) {
        Superpowered::FloatToShortInt(playerOutput, audio, (uint32_t) numberOfFrames);
        return true;
    }
    return false;
}

We have been plagued with SIGSEGV crashes from this one call to processStereo (about 50-60% of our reported crashes in the Play Store). Given that the code for the function is blackboxed in C++ I have been unable to debug the issue. Here is the reported crash from Google:

backtrace:
  #00  pc 0x000000000012e604  /data/app/~~7iCZqMj6gDYqYnUqpkXLXA==/app.....musicplayer-wTrI6x50RejhzbKh47a6lg==/lib/arm64/libSuperpoweredAdaptor.so (Superpowered::playerProcess::processAUTHREAD(float**, bool, unsigned int, float*, double, double, bool, double, double)+1348) (BuildId: 4ebdd90e1b567429a1f23383ff9b37791a725f3b)
  #01  pc 0x000000000012d22c  /data/app/~~7iCZqMj6gDYqYnUqpkXLXA==/app.....musicplayer-wTrI6x50RejhzbKh47a6lg==/lib/arm64/libSuperpoweredAdaptor.so (Superpowered::AdvancedAudioPlayer::processStereo(float*, bool, unsigned int, float)+76) (BuildId: 4ebdd90e1b567429a1f23383ff9b37791a725f3b)
  #02  pc 0x00000000000c4160  /data/app/~~7iCZqMj6gDYqYnUqpkXLXA==/app.....musicplayer-wTrI6x50RejhzbKh47a6lg==/lib/arm64/libSuperpoweredAdaptor.so (AudioProcessor::audioProcessing(void*, short*, int, int)+124) (BuildId: 4ebdd90e1b567429a1f23383ff9b37791a725f3b)
  #03  pc 0x00000000000c1a04  /data/app/~~7iCZqMj6gDYqYnUqpkXLXA==/app.....musicplayer-wTrI6x50RejhzbKh47a6lg==/lib/arm64/libSuperpoweredAdaptor.so (SuperpoweredAndroidAudioIO_OutputCallback(SLAndroidSimpleBufferQueueItf_ const* const*, void*)) (BuildId: 4ebdd90e1b567429a1f23383ff9b37791a725f3b)
  #04  pc 0x000000000001c27c  /system/lib64/libwilhelm.so (audioTrack_handleMoreData_lockPlay(CAudioPlayer_struct*, android::AudioTrack::Buffer const&)+124)
  #05  pc 0x000000000001ee9c  /system/lib64/libwilhelm.so (android::AudioTrackCallback::onMoreData(android::AudioTrack::Buffer const&)+44)
  #06  pc 0x0000000000096e98  /system/lib64/libaudioclient.so (android::AudioTrack::processAudioBuffer()+2856)
  #07  pc 0x0000000000096080  /system/lib64/libaudioclient.so (android::AudioTrack::AudioTrackThread::threadLoop()+272)
  #08  pc 0x0000000000013440  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+416)
  #09  pc 0x00000000000caf4c  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+140)
  #10  pc 0x00000000000c163c  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+204)
  #11  pc 0x0000000000054930  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions