AudioRecord acquireBuffer 与 AudioRecorder.startRecording() 超时
我的录制麦克风的程序有问题。有时,当我运行它时,我会收到以下警告,并且实际没有记录任何声音:
12-14 11:17:50.660: W/AudioRecord(1857): acquireBuffer timed out (is the CPU pegged?) user=00000000, server=00000000
根据我的发现,其他人也有 AudioTrack
的问题,如下所述此处和此处。但是,对我来说,AudioRecord
无法正常工作。我知道无论出于何种原因都无法创建缓冲区。当我开始录音过程时,开始出现警告:recorder.startRecording();
当我使用内置麦克风作为输入时,有时会出现此问题,但当蓝牙
时,通常会出现此问题code> 耳机用作输入。这是我使用蓝牙麦克风作为输入的代码:
audioManage = (AudioManager)this.getSystemService(Context.AUDIO_SERVICE);
if (!audioManage.isBluetoothScoOn()) {
audioManage.setBluetoothScoOn(true);
audioManage.startBluetoothSco();
audioStreaming = new AudioStreaming();
} else {
audioManage.startBluetoothSco();
audioStreaming = new AudioStreaming();
}
如何强制创建缓冲区?
信息:我使用的是 Android 3.0,并且我已经在 Xoom 平板电脑上测试了该程序。
编辑:
我刚刚意识到我也遇到了这个错误:
12-14 12:13:12.500: E/AudioPostProcessor(2541): Error Reading fromaudio in: Connection timed out
仅当程序无法与蓝牙配合使用。而且我还没有找到任何关于这个主题的东西......
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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用大于 minSize 的缓冲区并降低采样率。该消息通常意味着内核级别出现问题,例如有问题的 ALSA 音频驱动程序集成,但我不知道 Xoom 是否会遇到这种情况。所以,祝你好运!
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!
嗯,解决方案非常简单...我只是没有检查是否有新的更新可用...然后问题已自行修复。
Hum, the solution was quite simple... I just didn't checked if new updates where available... Problem has been fixed on it own then.