AudioRecord Lollipop crash

I have a crash in my application only in Lollipop, it works fine with previous versions. I am getting 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@framework@boot.oat
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?

+3


source to share


1 answer


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

These are the steps I took to fix this issue:

  • Make sure you don't confuse size byte

    with size short

    . The result returned from getMinBufferSize

    is in byte

    s, and the value that specifies the size of the buffer in the AudioRecord constructor is in byte

    s.
  • I switched from one array for all data (and played with offsets) to use a separate buffer, I don't know if it resolved that, but you can try it as well.


Next time, I would recommend that you attach the code. This can help people answer your questions easily (for example, I can find potential flaws in the code that could cause this problem).

EDIT:

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

+1


source







All Articles