Android AudioHardware pcm playback is going to standby

柔情痞子 提交于 2019-12-11 08:43:42

问题


Occasionally when I have a lot going on in my app, and I am playing a number of sounds using SoundPool, my app just completely freezes. Looking at the logs, I see this: I/AudioHardwareMSM72XX( 56): AudioHardware pcm playback is going to standby.

My app must then be force closed and restarted. Does anyone know what may be causing this, or a possible workaround? I cannot reproduce this in the emulator - only on my HTC Hero, so I am wondering if this may be a device specific bug.


回答1:


There are two possible causes of this.

Cause 1: If you don't keep hold of a reference to your MediaPlayer object it can get garbage collected even though it is playing something. I have some code in a repeating timer that plays a sound, I had to assign the MediaPlayer to a static variable to stop it being garbage collected, and the problem of the sound stopping part way through went away.

Cause 2: I've read that if you are streaming it is possible to give the MediaPlayer too much data and it dies - see this discussion thread: /593575">http://www.last.fm/group/Last.fm+Android/forum/114391//593575



来源:https://stackoverflow.com/questions/3047817/android-audiohardware-pcm-playback-is-going-to-standby

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!