2011-12-14 15 views
0

我的程序記錄麥克風有問題。有時,當我運行它,我有以下警告,並沒有健全的實際記錄: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爲解釋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

只有當程序不與藍牙工作。並且我還沒有發現任何關於此主題的內容...

回答

0

哼,解決方法很簡單......我只是沒有檢查是否有新的更新可用...問題已經修復它自己然後。

0

嘗試使用大於minSize的緩衝區並降低採樣率。這個消息通常意味着內核級別有些問題,比如錯誤的ALSA音頻驅動集成,但我不知道Xoom是否會遇到這種情況。所以,祝你好運!

+0

我試過,使用8000採樣率(最低),我已經添加2048到最小緩衝區大小。它與內置麥克風配合良好。我剛剛意識到,如果它與BT一起工作,那麼內置麥克風不再工作了...... – Flanfl 2011-12-14 12:04:45