user3820584
user3820584

Reputation: 73

AudioRecord Lollipop crash

I have a crash in my app just in Lollipop, is working perfect with previous versions. I get this crash:

F/libc    (25307): Fatal signal 7 (SIGBUS), code 2, fault addr 0x993b260c in tid 25750 (pool-16-thread-)
I/DEBUG   (14112): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (14112): Build fingerprint: 'google/hammerhead/hammerhead:5.0/LRX21O/1570415:user/release-keys'
I/DEBUG   (14112): Revision: '11'
I/DEBUG   (14112): ABI: 'arm'
I/DEBUG   (14112): pid: 25307, tid: 25750, name: pool-16-thread-  >>> de.shopnow <<<
I/DEBUG   (14112): signal 7 (SIGBUS), code 2 (BUS_ADRERR), fault addr 0x993b260c
I/DEBUG   (14112):     r0 993b260c  r1 8fd03344  r2 000006fc  r3 00000004
I/DEBUG   (14112):     r4 00001500  r5 00000000  r6 993b2d0c  r7 9e8ed640
I/DEBUG   (14112):     r8 00000700  r9 b591bd0c  sl 8d1ff7d4  fp 00000000
I/DEBUG   (14112):     ip 80000000  sp 8d1ff7c0  lr b58da9b7  pc b6f4cef8  cpsr 800b0030
I/DEBUG   (14112): 
I/DEBUG   (14112): backtrace:
I/DEBUG   (14112):     #00 pc 00012ef8  /system/lib/libc.so (__memcpy_base+59)
I/DEBUG   (14112):     #01 pc 000569b3  /system/lib/libmedia.so (android::AudioRecord::read(void*, unsigned int)+82)
I/DEBUG   (14112):     #02 pc 00095dbb  /system/lib/libandroid_runtime.so
I/DEBUG   (14112):     #03 pc 00270fd7  /data/dalvik-cache/arm/system@[email protected]
W/debuggerd(14112): type=1400 audit(0.0:278): avc: denied { read } for name="kgsl-3d0" dev="tmpfs" ino=6205 scontext=u:r:debuggerd:s0 tcontext=u:object_r:gpu_device:s0 tclass=chr_file
W/debuggerd(14112): type=1400 audit(0.0:279): avc: denied { read } for name="kgsl-3d0" dev="tmpfs" ino=6205 scontext=u:r:debuggerd:s0 tcontext=u:object_r:gpu_device:s0 tclass=chr_file
W/AudioFlinger(  185): RecordThread: buffer overflow

Any ideas?

Upvotes: 3

Views: 737

Answers (1)

Elad92
Elad92

Reputation: 2491

I had the same problem as you, after rewriting my audio recording code the crashes stopped.

Those are the steps I've taken in order to fix this problem:

  1. Make sure you are not confusing byte size with short size. The result returned from getMinBufferSize is in bytes, and also the value that sets the buffer size in the AudioRecord's constructor is in bytes.
  2. I switched from using one array for all the data (and playing with offsets) to using separate buffer, I don't know if that is what solved it but you can also try it.

I'd recommend you to attach some code next time. It might help people answer your questions easily (I, for example, could find potential flaws in your code that might cause this problem).

EDIT:

As mentioned in the comment, this is an open issue that can be found here, so the solution to this problem is the second step mentioned in the answer.

Upvotes: 1

Related Questions