[alsa-devel] ASoC: mmap or read/write?
pj0585 at gmail.com
Thu Oct 18 11:37:45 CEST 2012
On Thu, Oct 18, 2012 at 2:39 PM, Clemens Ladisch <clemens at ladisch.de> wrote:
> Prasant J wrote:
>> I'm writing an alsa application for recording & playing 16 channel audio.
>> The application is intended to run on an embedded platform & the
>> resources are highly constrained.
> Then I wonder how you manage to handle 16 channels.
> What hardware is this?
I'm working with Beaglebone (ARM Cortex-A8 720 MHz). (Currently
failures are for 8 channels 32 bit / 16 bit, but our final target is
>> My application is not performing well with read/write methods.
> How much CPU usage?
The CPU usage is around 35% (as seen in top)
I have managed to get Audio capture working fine (after certain linux
optimizations) but playback is giving under-runs (only when PLAYBACK &
CAPTURE run together)
I was wondering that changing access method to mmap (currently I'm
using read/write) may give me some more CPU time.
>> Does the mmap method has any advantages over read/write?
> No, except when then samples are generated in/consumed from the
> device's buffer directly without copying them around, and even then
> it's unlikely that the time needed for copying actually matters.
>> Is there any thumb rule to decide when to use mmap or read/write?
> Yes; use read/write.
OK. You say read/write is the best apart from the one use case you
mentioned, makes sense, because, irrespective I use read/write or
mmap, in my case, I will anyway have to copy the buffers to mmap-ed
Thanks for inputs!
More information about the Alsa-devel