Skip to contentSkip to conversation

alsa-lib: mmap API disables blocking I/O or sw_params

DISCUSSION Mark Hills 1 participant 1 message May 27, 2020

lore
Share & tools
lore

Mark Hills

author
#0 lore raw

I'm swapping out a vanilla loop based on RW_INTERLEAVED for MMAP_INTERLEAVED, to reduce memory copies:

The equivalent code becomes:

snd_pcm_avail_update()
snd_pcm_mmap_begin()
snd_pcm_mmap_commit()

but what I find no longer works:

* Blocking I/O: it's necessary to make explicit calls to snd_pcm_wait() with syscall overhead of poll()

* Automatic start (and perhaps others): so I have to count the frames committed and call snd_pcm_start() explicitly.

I don't think these are conceptually incompatible with mmap, so is this the intended behaviour and an important omission from the docs? Or is the mmap API not widely used and I'm stumbling on bugs?

Signature · 1 line
Mark