I am using audio recorder, i am not able to identify where the error is thrown! the app crashes ...
for (int rate : new int[]{8000, 11025, 16000, 22050, 44100}) {
mBufferSize = AudioRecord.getMinBufferSize(rate, AudioFormat
.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT);
}
mAudioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC,
RECORDER_SAMPLERATE,
RECORDER_CHANNELS,
RECORDER_AUDIO_ENCODING,
mBufferSize);
i refered stack but didn;t find relevant answer... stack strace :
01-05 18:25:19.863 21646-23485/com.voicy.demo A/AudioTrackShared: Assertion failed: !(stepCount <= mUnreleased && mUnreleased <= mFrameCount)
01-05 18:25:19.863 21646-23485/com.voicy.demo A/libc: Fatal signal 6 (SIGABRT) at 0x0000548e (code=-6), thread 23485 (AudioRecorder T)
01-05 18:25:20.333 1061-1107/? E/InputDispatcher: channel '424b68b0 com.voicy.demo/com.voicy.demo.ui.HomePageActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
01-05 18:25:20.333 1061-1107/? E/InputDispatcher: channel '42d324d0 com.voicy.demo/com.voicy.demo.ui.HomePageActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
01-05 18:25:20.333 1061-1107/? E/InputDispatcher: channel '424b3a60 com.voicy.demo/com.voicy.demo.ui.ChatMessageActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
What's with:
This is calculating
mBufferSize
with different values, eventually ending with44100
, which admittedly will be a safe number.In this case, it should be:
Error is likely caused by the source buffer being disposed in mid-air.
Get inspired by this or that StackOverflow answer.