[pulseaudio-discuss] Polling problem with a PCM device

Loris lb at 2m.dk
Mon Dec 8 01:21:36 PST 2008


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 get a similar behaviour if I use module-oss.c as a basis for the 
implementation.

I added some debug info to rtpoll.c and it seems that inside pa_rtpoll_run 
events are always set to POLLIN, even though it is explitly set to POLLOUT 
(module-pipe-sink.c:176).

Anyhow, I am not sure of what exactly the problem is and running out of ideas 
on what to try.

Does anyone have an idea ?

Thanks,

Loris

-------

$ diff module-pipe-sink.c module-pcm-sink.c
65c65
< #define DEFAULT_FILE_NAME "/tmp/music.output"
---
> #define DEFAULT_FILE_NAME "/dev/aud_pcm"
235,236c235
<     mkfifo(u->filename, 0666);
<     if ((u->fd = open(u->filename, O_RDWR|O_NOCTTY)) < 0) {
---
>     if ((u->fd = open(u->filename, O_WRONLY|O_NOCTTY)) < 0) {
249,253d247
<     if (!S_ISFIFO(st.st_mode)) {
<         pa_log("'%s' is not a FIFO.", u->filename);
<         goto fail;
<     }
<
324,328d317
<     if (u->filename) {
<         unlink(u->filename);
<         pa_xfree(u->filename);
<     }
<



More information about the pulseaudio-discuss mailing list