我的程序記錄麥克風有問題。有時,當我運行它,我有以下警告,並沒有健全的實際記錄:AudioRecord obtainBuffer超時與AudioRecorder.startRecording()
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
只有當程序不與藍牙工作。並且我還沒有發現任何關於此主題的內容...
我試過,使用8000採樣率(最低),我已經添加2048到最小緩衝區大小。它與內置麥克風配合良好。我剛剛意識到,如果它與BT一起工作,那麼內置麥克風不再工作了...... – Flanfl 2011-12-14 12:04:45