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

Mark Hills mark at xwax.org
Thu May 28 00:14:45 CEST 2020


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?

-- 
Mark


More information about the Alsa-devel mailing list