[alsa-devel] safe support for rewind in ALSA

Jaroslav Kysela perex at perex.cz
Mon Feb 1 19:00:52 CET 2010

On Mon, 1 Feb 2010, pl bossart wrote:

> All,
> I'd like to reopen a thread on concerns with the current
> implementation of rewind in ALSA. This was already discussed on the
> mailing list last year without any progress.

I don't think that there have been no progress. The queued samples can be 
stored to runtime->delay now, so snd_pcm_delay() returns a correct 

The snd_pcm_rewind() and snd_pcm_forward() functions should operate in the 
ring buffer and it's ok. See the USB driver for an example. Just add 
support for runtime->delay to the lowlevel drivers and use snd_pcm_delay() 
correctly in the user space and everything will work as expected.

In other words - for hardware with large FIFOs, the runtime->delay should 
be used for queued samples and the hw_ptr in the ring buffer should be 
increased as soon as the FIFO is filled with samples from the ring buffer.


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

More information about the Alsa-devel mailing list