obtainBuffer timed out (is the CPU pegged?)

https://stackoverflow.com/questions/5293025/audiotrack-lag-obtainbuffer-timed-out [典]

03-13 14:55:57.100: WARN/AudioTrack(3454): obtainBuffer timed out (is the CPU pegged?) 0x2e9348 user=00000960,     server=00000000
03-13 14:55:57.340: WARN/AudioFlinger(72): write blocked for 233 msecs, 9 delayed writes, thread 0xba28

I ran into a similar problem, although I was using a RandomAccessFile, instead of a BufferedInputStream, to read the PCM data. The issue was that the file I/O was too slow. I suspect you will have this problem even with a buffered stream, because the I/O is still taking place on the same thread as audio processing.

The solution is to have two threads: A thread that reads buffers from a file and queues them into memory, and another thread that reads from this queue and writes to the audio hardware. I used a ConcurrentLinkedQueue to accomplish this.

I used the same technique for recording, using AudioRecord, but in the reverse direction. The key is to place the file I/O on a separate thread.

https://stackoverflow.com/questions/7398392/android-audiotrack-only-plays-first-2-seconds-back-then-stops

09-13 09:13:24.816: WARN/Archive(1066): audiostate is: 3
09-13 09:13:26.089: WARN/AudioTrack(1066): obtainBuffer() track 0x298b18 disabled, restarting
09-13 09:13:27.214: WARN/AudioTrack(1066): obtainBuffer() track 0x298b18 disabled, restarting
09-13 09:13:28.332: WARN/AudioTrack(1066): obtainBuffer() track 0x298b18 disabled, restarting
09-13 09:13:29.457: WARN/AudioTrack(1066): obtainBuffer() track 0x298b18 disabled, restarting

I just saw the logcat: obtainBuffer() track 0x298b18 disabled, restarting .. that is to say : you have not got audio data and the input audio stream have been stopped .so the buffer must wait for the audio stream in. i think you should check the inputstream and the read method. you must ensure that you have read the audio data continuously.

https://stackoverflow.com/questions/24378916/obtainbuffer-timed-out-is-the-cpu-pegged

obtainBuffer timed out (is the CPU pegged?)

https://www.oschina.net/question/1273322_128331

媒体资源没有释放 E AudioMixer: AudioMixer::getTrackName out of available tracks

 检查下代码 临时的播放资源需要及时释放

https://bbs.csdn.net/topics/390134512

https://blog.csdn.net/bberdong/article/details/52161426

原文地址:https://www.cnblogs.com/Ph-one/p/8669418.html