Pulseaudio hogging CPU

Mikko Rauhala mjrauhal at cc.helsinki.fi
Thu Jan 17 01:58:23 CET 2008

Greetings and salutations

Pulseaudio's behavior on my Neo has annoyed me for a while, and now I
got around to poking it a bit, with not much results but some. The
visible issue is that eg. when playing music with openmoko-mediaplayer,
the pulseaudio server hogs up 25-30% of the CPU, which is enough to
cause serious skipping of the audio (at least my sample ogg tracks from
Harvey Danger, googlable for free download). This with no other clients
playing anything, of course, so no mixing required, just pushing bits
from buffer to sound driver.

ogg123, not going through pulseaudio, plays the same tracks quite well
at around 80% CPU. Pulseaudio behavior is the same whether I use native
ALSA or OSS sinks.

I straced pulseaudio a bit while playing music. Obviously, the strace
emphasized the skipping severely and quite possibly isn't useful for
diagnosis due to altering a lot of the timing, but some stuff was still
going through.

Anyway, the thing that caught my eye was that between each write to the
audio device there were 16 pairs of alternating calls:
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0

I presumed this to be threading-related, but apparently pulseaudio
doesn't do threads after all. Then I presumed it to be rabid syncing
with the shared memory area the client uses to communicate with it, but
it seems to persist with --disable-shm (as does the CPU hogging, whether
it's related or not). Now I just presume pulseaudio is on crack.

Soo yeah. At this point I'd like to ask if anyone has any clue on...
1) what kind of crack it is?
2) where can we find and steal its crack?

One should hopefully be able to have a decent mediaplayer experience
without waiting for GTA-02 in order to have more CPU to feed to the
relentless pulseaudio.

(Despite pulseaudio offering some services besides mere software mixing,
one could also wonder if it's more trouble than worth instead of just
using alsa, dmix and, for the higher level stuff, gstreamer, but I
digress somewhat. Hopefully it's easily fixable to consume sane amounts
of CPU regardless.)

Mikko Rauhala   - mjr at iki.fi     - <URL:http://www.iki.fi/mjr/>
Transhumanist   - WTA member     - <URL:http://www.transhumanism.org/>
Singularitarian - SIAI supporter - <URL:http://www.singinst.org/>

More information about the distro-devel mailing list