【问题标题】:AudioRecord obtainBuffer Timed out with AudioRecorder.startRecording()AudioRecord gainBuffer Timed out with AudioRecorder.startRecording()
【发布时间】: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 的其他人也有这个问题,正如 herehere 所解释的那样。但是,对我来说,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


    【解决方案1】:

    嗯,解决方案很简单...我只是没有检查是否有可用的新更新...问题已经自己解决了。

    【讨论】:

      【解决方案2】:

      尝试使用大于 minSize 的缓冲区并降低采样率。该消息通常意味着内核级别的某些错误,例如有错误的 ALSA 音频驱动程序集成,但我不知道 Xoom 是否会遇到这种情况。所以,祝你好运!

      【讨论】:

      • 我试过了,使用 8000 采样率(最小值),我在最小缓冲区大小中添加了 2048。它与内置麦克风配合得很好。我刚刚意识到,如果它与 BT 一起工作,那么内置麦克风就不再工作了......
      猜你喜欢
      • 1970-01-01
      • 2023-02-09
      • 2022-12-28
      • 2018-07-17
      • 1970-01-01
      • 2019-06-17
      • 2015-09-11
      • 2021-12-06
      • 2013-05-01
      相关资源
      最近更新 更多