I am writing a VOIP phone application and testing it on MOTO
milestime. Sometime I meet a "obtainBuffer timed out" exception when i
am calling AudioRecord.read , it don't return me any result but just
block the thread. Runing on emulator with 1.5 OS won't get this
exception. My codes:
AudioRecord record = new AudioRecord(
MediaRecorder.AudioSource.MIC, 8000,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT,
// 100000
AudioRecord.getMinBufferSize(8000,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT)
);
record.startRecording();
int num = record.read(lin,offsetInShorts ,sizeInShorts);
.......
......
when it is blocked , run these code can solve the problem.
AudioManager am = (AudioManager)
Receiver.mContext.getSystemService(Context.AUDIO_SERVICE);
am.setMode(mode);
am.setMode(AudioManager.MODE_NORMAL);
..............
am.setMode(AudioManager.MODE_INCALL);
Anybody have any idea on this ?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
To unsubscribe, reply using "remove me" as the subject.