android.media.AudioRecord.read related crash

62 Views Asked by At

According to Google Play, the following crash occurs on Samsung devices:

[libc.so] abort
SIGABRT

backtrace:
  #00  pc 0x00000000000537d4  /apex/com.android.runtime/lib64/bionic/libc.so (abort+168)
  #01  pc 0x00000000006f365c  /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+596)
  #02  pc 0x0000000000016ea8  /apex/com.android.art/lib64/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+80)
  #03  pc 0x0000000000006f60  /system/lib64/liblog.so (__android_log_assert+312)
  #04  pc 0x00000000000b20bc  /system/lib64/libaudioclient.so (android::ClientProxy::releaseBuffer(android::Proxy::Buffer*)+240)
  #05  pc 0x00000000000654c0  /system/lib64/libaudioclient.so (android::AudioRecord::releaseBuffer(android::AudioRecord::Buffer const*)+168)
  #06  pc 0x0000000000068484  /system/lib64/libaudioclient.so (android::AudioRecord::read(void*, unsigned long, bool)+388)
  #07  pc 0x0000000000188ca0  /system/lib64/libandroid_runtime.so (int android_media_AudioRecord_readInArray<_jshortArray*>(_JNIEnv*, _jobject*, _jshortArray*, int, int, unsigned char)+232)
  #08  pc 0x00000000002ee1c0  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+128)
  #09  pc 0x00000000020009f0  /memfd:jit-cache (android.media.AudioRecord.read+240)

enter image description here I think it is related to the following code that works flawlessly on other devices (this app has millions of downloads):

AudioRecord ar = new AudioRecord(MediaRecorder.AudioSource.MIC, iAudioSampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, N * 10);
...
_ar.startRecording();
...
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    iReadCount = _ar.read(buffer, 0, buffer.length, AudioRecord.READ_NON_BLOCKING);
} else {
    iReadCount = _ar.read(buffer, 0, buffer.length);
}

Does anyone know the possible causes of this and any potential remedies?

0

There are 0 best solutions below