[LAD] ALSA latency and MMAP

Clemens Ladisch clemens at ladisch.de
Mon Sep 7 08:53:49 UTC 2009

Paul Davis wrote:
> if you use read/write, you deliver/receive the data to/from the kernel
> at the time of calling. but there is then an extra buffer inside the
> ALSA midlevel driver code that holds the data till it is needed (in
> both directions).

There is no extra buffer for these functions; snd_pcm_write/read* copy
the data to/from the same hardware buffer that would be used by the mmap

The only case where there is a separate buffer is when the data written
by the application is not the same as the data to be written to the
hardware, i.e., when using dmix or sample format conversion.  But when
using those plugins, the read/write and mmap functions still all use
the same buffer.

Using mmap does not give any latency advantage when the application
copies the data from some other buffer into the hardware buffer, i.e.,
if it does the same as snd_pcm_write.

Best regards,

More information about the Linux-audio-dev mailing list