Skip to contentSkip to conversation

Problems with snd_pcm_wait(..)

DISCUSSION Markus Luttenberger 2 participants 3 messages Jan 11, 2010

lore
Share & tools
lore
#0 lore raw

Hey,

I tried to implement a callback functionality with ALSA based on the example given at
http://www.cs.utk.edu/~vose/linux/equalarea.com/alsa-audio.html#interruptex.
Especially the while-loop is basically the same in my program. However, it doesn't work. I can trace the program to snd_pcm_wait(..) which just waits endlessly.

The whole thing is called within a thread. The thread is still accessible from elsewhere in the pogram. It's just the snd_pcm_wait(..)-function which does not return although a time-out of 1000 ms is given.

If I don't wait for the device I get the following assertion:
pcm.c:1079: snd_pcm_writei: Assertion `size == 0 || buffer' failed.

Any ideas what could be wrong?

greetings..
..Markus

#1 lore raw
Quoted 9 lines · Markus Luttenberger

Hey,

I tried to implement a callback functionality with ALSA based on the example given at
http://www.cs.utk.edu/~vose/linux/equalarea.com/alsa-audio.html#interruptex.
Especially the while-loop is basically the same in my program. However, it doesn't work. I can trace the program to snd_pcm_wait(..) which just waits endlessly.

Which device you're using? If PulseAudio is in path, there is a bug fixed recently:

https://bugzilla.redhat.com/show_bug.cgi?id=534130

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

#2 lore raw
In reply to Markus Luttenberger
Quoted 6 lines · Markus Luttenberger

I tried to implement a callback functionality with ALSA based on the example given at
http://www.cs.utk.edu/~vose/linux/equalarea.com/alsa-audio.html#interruptex.
Especially the while-loop is basically the same in my program. However, it doesn't work. I can trace the program to snd_pcm_wait(..) which just waits endlessly.

Oops, I overlooked something obvious (I set the snd_pcm_sw_params_set_avail_min(..) to the wrong value). Ignore my question, sorry.

greetings..
..Markus