我正在使用AudioTrack的额外线程来播放我之前在另一项活动中录制的wave文件。
当我开始播放时,我在LogCat中获得以下输出:
09-13 09:13:13.207: WARN/Archive(1066): audioplayThread is running..., state is: READY
09-13 09:13:21.187: WARN/Archive(1066): wave file /mnt/sdcard/myrecording/myrecording_3_12-09-2011_14-14.wav
09-13 09:13:22.582: WARN/Archive(1066): audioPlayer bufferSize 4090
09-13 09:13:22.582: WARN/Archive(1066): audioPlayer wave length 206432
09-13 09:13:22.601: DEBUG/AudioHardware(75): AudioHardware pcm playback is exiting standby.
09-13 09:13:22.601: DEBUG/AudioHardware(75): openPcmOut_l() mPcmOpenCnt: 0
09-13 09:13:22.683: WARN/AudioFlinger(75): write blocked for 82 msecs, 1 delayed writes, thread 0xcb08
09-13 09:13:24.816: WARN/Archive(1066): playbackHeadposition is: 49591
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
...
答案 0 :(得分:0)
我之前遇到过同样的问题。我使用了vitamio bundle,这是Android的Media Player的对应物,并且有更多的音频支持。尝试将此代码添加到清单中:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
我希望这会有所帮助。
答案 1 :(得分:0)
当写入的样本数量不能被通道数整除时,我发现了同样的问题。
例如:
频道数量:2
mAudioTrack.write(buffer,0,75);