Sample Header Ad - 728x90

How to make Android play music reliably, without chopping?

10 votes
2 answers
8937 views
When I try to play music on Android 2.3 (using various players, including PowerAmp) on Sony Ericsson Xperia X10 I get not reliable sound. Music pauses for a short time, for example, when: * I press the power button (especially repeatedly) (request_suspend_state: sleep;request_suspend_state: wakeup in dmesg) * When I see messages like send sigkill to 15497 (ndroid.settings), adj 8, size 6428 in dmesg * When some program reacts to changed screen orientation. * When wifi connection gets established, when I force it to "reassociate" * When I go to/from application from home screen (AWDLauncher), except of to/from WidgetLocker screen. * When I enable/disable Airplane Mode. * When the display is off (the most annoying) When only really stable way to play music is to use StayAwake to force display on, turn off Wi-Fi, turn on Airplane Mode and don't switch applications. Starting CPU hogs like while true; do true; done does not affect chopping. And it was playing more or less fine on Android 2.1. "mediaserv" process (that writes to /dev/msm_pcm_out) has realtime io and scheduling priority, but sound is choppy anyway. If I start playing from console with mplayer -ao pcm:file=/dev/msm_pcm_out the sound chop less (notably it does not get interrupted by power button / loading bunches of heavy processes), but still behave not normally when screen is off (even ionice -c1 -p4 cat /dev/urandom > /dev/msm_pcm_out is choppy) When I start music A by usual way and music B using mplayer to /dev/msm_pcm_out (getting them mixed) music A chops more than usual and I usually hear B when A is in chop. When I turn off screen, both A and B chops in sync (stopping B leads to relatively more fluent playback of A this way). How to play music on Android reliably in presence of background load? Should I report a bug somewhere? Update Found a way of playing music. Inconvenient, but _without chopping_: 1. Start WakeLock in "CPU on, Screen Off, Keyboard off" mode 2. Use mplayer to play music bypassing Android: ionice -c1 -n4 \ schedtool -R -p 3 -e \ mplayer -really-quiet \ -af volume=-26 -quiet \ -ao pcm:file=/dev/msm_pcm_out,nowaveheader \ /mnt/sdcard/music/something.ogg # (created script to start it easily, of course) Plays without chopping no matter how much applications I start, what do with Wifi, orientation and airplane modes. Even with "powersave" cpufreq governor (everything very slow, but music plays fine). So the hardware have enough resources to play it. Update 2 Looks like doing for i in pgrep ''; do schedtool -D $i; done i.e. "Set Idle priority for all processes" makes music play fine even when I {start programs,lock screen,rotate screen;it reconnects to other mobile network stations} at expense of some input lag in games. Don't know exactly why it happens.
Asked by Vi0 (1705 rep)
Jan 15, 2012, 04:34 PM
Last activity: Jul 30, 2021, 08:00 PM