Using MMAP feature
Hello,
I'm going to use the MMAP feature of ALSA. I understood I have to use snd_pcm_mmap_begin and snd_pcm_mmap_commit functions, but I can't understand the meaning of some parameters in the snd_pcm_mmap_begin function: when I call this function in order to have access to the capture stream on a call like this:
err = snd_pcm_mmap_begin(capture, &c_area, &c_offset, &c_frames);
it keeps to return c_frames = 0: is it right ? what does this mean? is the buffer full so that I can read samples or the available contiguous space to be read is 0?
Thank you,
Alberto
Signature · 10 lines
Dr. Villa Alberto Sw Engineer SeleTech srl via Collodi, 8 20052 Monza (MI) tel: +39 039 5962000 fax: +39 039 9716905 email: [email protected] web: www.seletech.com www.seletech.eu
alberto Villa wrote:> Hello,
Quoted 1 line
I'm going to use the MMAP feature of ALSA.
Why do you need to do this?
Quoted 3 lines
snd_pcm_mmap_begin(capture, &c_area, &c_offset, &c_frames);it keeps to return
c_frames= 0: is it right ? what does this mean?
It means that there are no samples available at the moment. (Or that you forgot to call snd_pcm_avail_update(), or that you didn't set c_frames before the call.)
Regards,
Clemens
A message that is not in the archive (sent off-list or not yet received): [email protected]
(please don't drop the mailing list)
(please configure your mailer to wrap lines)
Quoted 9 lines · alberto Villa
Il 23/07/2012 12:38, Clemens Ladisch ha scritto:
Quoted 5 lines
Quoted 2 lines · alberto Villa
Hello,
I'm going to use the MMAP feature of ALSA.Why do you need to do this?
I need to use MMAP because we are running on an embedded system and we want to optimize its operations.
What exactly do you want to optimize? In most cases, mmap is no faster than snd_pcm_write; using mmap make sense only if the samples are generated dynamically without storing them in a userspace buffer.
Quoted 2 lines
It was necessary to use
snd_pcm_wait()beforesnd_pcm_begin(), may be this the reason?
If you never wait, the buffer will be filled eventually.
Regards,
Clemens