[alsa-devel] Call out after period buffer is filled

Jon Smirl jonsmirl at gmail.com
Tue May 5 17:31:42 CEST 2009


On Tue, May 5, 2009 at 10:35 AM, Jon Smirl <jonsmirl at gmail.com> wrote:
> Is there some way to get a call out after a period DMA buffer is
> filled so that I can add it to the DMA queue?

The current model in my driver is to queue up a bunch of DMA
descriptors, one per period. When I queue these I don't know if the
DMA buffers have music in them or not. I then start this queue playing
and tell ALSA when each period has finished. After each period plays I
requeue the descriptor. I keep hoping that ALSA can get these filled
before they start playing.

After the last period plays ALSA calls trigger(STOP). At that point I
try to shut down the DMA hardware and get the descriptors back. But
because of the FIFO and asynchronous DMA engine I can't stop DMA fast
enough in the trigger(STOP) routine. The result is that the next
period starts playing. This period has data from earlier in the stream
and it sounds like a burst of noise.

What I need is a call back indicating which buffers have valid data in
them. When I know the buffer is valid I can queue the descriptor. This
will fix the problem at end of stream since there won't be buffers
queued containing invalid data.

-- 
Jon Smirl
jonsmirl at gmail.com


More information about the Alsa-devel mailing list