【发布时间】:2012-01-20 04:36:05
【问题描述】:
我录制麦克风的程序有问题。有时当我运行它时,我会收到以下警告并且实际上没有记录声音:
12-14 11:17:50.660: W/AudioRecord(1857): obtainBuffer timed out (is the CPU pegged?) user=00000000, server=00000000
根据我的发现,AudioTrack 的其他人也有这个问题,正如 here 和 here 所解释的那样。但是,对我来说,AudioRecord 工作不正常。我了解无论出于何种原因都无法创建缓冲区。当我开始录制过程时,警告开始出现:recorder.startRecording();
当我使用内置麦克风作为输入时,有时会出现此问题,但在使用 Bluetooth 耳机作为输入时经常会出现此问题。这是我使用Bluetooth 麦克风作为输入的代码:
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 from audio in: Connection timed out
仅当程序不使用蓝牙时。而且我还没有找到关于这个主题的任何东西......
【问题讨论】:
标签: android bluetooth timeout buffer android-3.0-honeycomb