0

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...

Community
  • 1
  • 1
Flanfl
  • 516
  • 8
  • 29

2 Answers2

0

Try to use buffer larger than minSize and low down the sample rate. The message usually means some thing wrong in kernel level, like buggy ALSA audio driver integration, but I don't know if Xoom will run into the case. So, Good Luck!

pinxue
  • 1,736
  • 12
  • 17
  • I tried that, using 8000 sample rate (the minimum) and I've added 2048 to the min buffer size. It is working well with the built-in mic. I just realised that if it is working with the BT then the built-in mic is not working anymore... – Flanfl Dec 14 '11 at 12:04
0

Hum, the solution was quite simple... I just didn't checked if new updates where available... Problem has been fixed on it own then.

Flanfl
  • 516
  • 8
  • 29