[pulseaudio-discuss] Polling problem with a PCM device

Lennart Poettering lennart at poettering.net
Wed Dec 10 11:15:30 PST 2008

On Mon, 08.12.08 10:21, Loris (lb at 2m.dk) wrote:

> Hello,
> I would like to use pulseaudio on a PCM device (no ALSA, no OSS). For this, I 
> made some modifications to module-pipe-sink so that it writes to the PCM 
> device instead of the FIFO. (below is a minimal patch that shows how I did it 
> (I am working on the 0.9.10 version)):
> The problem is in the thread_func main loop (line 137):
> if (u->sink->thread_info.state == PA_SINK_RUNNING && pollfd->revents) {
> pollfd->revents is never set, so nothing is ever written to the device. I will 
> get sound if I void the check:
> if (u->sink->thread_info.state == PA_SINK_RUNNING) {
> But then of course I get a very high CPU usage.

I am not sure what kind of audio device you have there. The code in
question relies on properly implemnented file descriptors that signal
writabilty via POLLOUT when polled with poll(). If your device driver
doesn't support that, than you should probably fix it first. Of
course, it should be a much better idea to simply write a proper ALSA driver.

Please note that you won't have much fun with PA if you don't have a
proper implementation of the timing interfaces.


Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net         ICQ# 11060553
http://0pointer.net/lennart/           GnuPG 0x1A015CC4

More information about the pulseaudio-discuss mailing list