I have a problem with my program which records the microphone. Sometimes when I run it I have the following warnings and no sound is actually recorded:
12-14 11:17:50.660: W/AudioRecord(1857): obtainBuffer timed out (is the CPU pegged?) user=00000000, server=00000000
From what I have found, other have this problem with AudioTrack
as explained here and here. However, for me it is AudioRecord
which is not working properly. I understand that the buffer cannot be created for whatever reason. The warning start to appear when I start the recording process: recorder.startRecording();
This problem happens sometimes when I use the built-in microphone as input, but often when the Bluetooth
headset is used as input. Here is my code to use the Bluetooth
microphone as input:
audioManage = (AudioManager)this.getSystemService(Context.AUDIO_SERVICE);
if (!audioManage.isBluetoothScoOn()) {
audioManage.setBluetoothScoOn(true);
audioManage.startBluetoothSco();
audioStreaming = new AudioStreaming();
} else {
audioManage.startBluetoothSco();
audioStreaming = new AudioStreaming();
}
How can I force the buffer creation?
INFO: I'm using Android 3.0 and I've tested the program on a Xoom tablet.
EDIT:
I just realised that I've got this error too:
12-14 12:13:12.500: E/AudioPostProcessor(2541): Error reading from audio in: Connection timed out
Only when the program is not working with the Bluetooth. And I haven't found anything on the subject...