[alsa-devel] Polling issues with the PCM multi plugin

Devin Anderson surfacepatterns at gmail.com
Thu Dec 13 06:57:56 CET 2012


Hi all,

On the jack-devel list, we've been having a discussion about the ALSA
PCM multi plugin:

    http://thread.gmane.org/gmane.comp.audio.jackit/26571/focus=26571

I've been having some issues with setting up my 2 Echo Layla 3Gs as a
PCM multi.  In particular, I've found that there are times when
polling the file descriptors of the multi when poll() returns, but
there isn't actually a period of data available for capture/playback,
even though the poll descriptors indicate that the data should be
available.  After some debugging and learning about the PCM multi
driver:

1.) The PCM multi driver only returns poll descriptors for one of the
devices that makes up the multi
2.) When this happens, the device that's actually being polled *does*
have data available
3.) When this happens, the device that's not being polled does not yet
have a period's worth of data available

After making sure that I had word clock enabled and that my word clock
cable was working properly, I started delving into the problem some
more.  From what I can gather, the PCM multi device uses the function
`snd_pcm_link()` to sync its devices, and, for start, stop, drain,
pause, suspend, resume, reset, and prepare operations, this appears to
work fine; however, I can't find any evidence that a PCM device checks
to make sure that all of its linked slave devices have their poll
descriptors ready with events before indicating that events are
available.

Questions:

1.) Should `snd_pcm_link` make I/O availability indication dependent
on I/O availability of its linked slave devices?
2.) If not, how should this operation be handled?  I'm sure it *can*
be handled in userspace by bypassing the multi and polling the file
descriptors of all sound cards directly, but duplicating this code for
each application that wants to poll multiple sound cards seems wrong.

Thanks,

-- 
Devin Anderson
surfacepatterns (at) gmail (dot) com

blog - http://surfacepatterns.blogspot.com/
psinsights - http://psinsights.googlecode.com/
synthclone - http://synthclone.googlecode.com/


More information about the Alsa-devel mailing list