[alsa-devel] Asterisk 1.4.17 and alsa 1.0.19 dmix plugin problem.

Jaroslav Kysela perex at perex.cz
Mon Apr 20 20:44:42 CEST 2009


On Mon, 20 Apr 2009, Nicola Mfb wrote:

> Hi!
> I'm sorry if this is an old issue but I did not found help in
> archives/alsaweb/google and I'm new to alsa, so this report is what I
> guessed reading sources and compiling test apps for about 2 days, and
> the following assumptions may be completely wrong.
>
> Asterisk has an alsa channel that works fine when using plughw:0,0
> both for read and for writing, but if use plug:dmix/plug:dsnoop or
> default with a dmix/dsnoop wrapper in /etc/asound.conf it does not
> emit any sound. It uses select on poll fd descriptor to know if the
> pcm is ready to be sent output samples.
> The select will never return as it seems the dmix plugin is not able
> to signal when is ready.
> I noted that using snd_pcm_wait works well but cannot be used in
> asterisk as it needs to select on two fd.
> I guess that snd_pcm_wait with dmix check the shared memory and not
> the fd descriptor.
> So should poll/select be avoided completely in applications (as they
> does not know if the default pcm is a dmix) and asterisk alsa channel
> be rewritten or is there a workaround?

Asterisk does not use snd_pcm_poll_descriptors_revents to translate events 
returned from poll to correct poll event. Also, only file descriptor 
number from snd_pcm_poll_descriptors() - asterisk should handle correctly 
returned poll events as well.

See chan_alsa.c - readdev / writedev variables and sound_thread().

 					Jaroslav

-----
Jaroslav Kysela <perex at perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.



More information about the Alsa-devel mailing list