[LAD] ALSA latency and MMAP

Clemens Ladisch clemens at ladisch.de
Tue Sep 8 15:02:12 UTC 2009

Paul Davis wrote:
> On Tue, Sep 8, 2009 at 2:39 AM, Clemens Ladisch<clemens at ladisch.de> wrote:
>> Paul Davis wrote:
>>> On Mon, Sep 7, 2009 at 10:54 AM, Clemens Ladisch<clemens at ladisch.de> wrote:
>>>> Paul Davis wrote:
>>>>> snd_pcm_write() and snd_pcm_read(), IIRC, allow reads&writes of chunks
>>>>> of data that are not period-sized.
>>>> Yes.  So does snd_pcm_mmap_commit().
>>> something must have changed. "back in the day", you could not possible
>>> use the mmap API to deliver > 1 period at a time. has that changed?
>> I don't know about "those days", but if that was the case then, it has
>> indeed changed.
> the documentation for snd_pcm_writei() notes:
> "If the blocking behaviour is selected, then routine waits until all
> requested bytes are played or put to the playback ring buffer. ...
> do you want to clarify your comment about "no additional buffering"?

That "playback ring buffer" is the hardware buffer.  If there is not
enough free space in the buffer, it has to wait.  (It is even possible
to _writei() more data than would fit in the entire buffer.)

In the case of mmap, snd_pcm_mmap_begin() never returns more frames than
are available in the buffer, so it is never possible for _commit() to
be in a situation where it would have to wait.

Best regards,

More information about the Linux-audio-dev mailing list