From: Clemens Ladisch <clemens@ladisch.de>
To: Jan Homann <jh@janhomann.de>, alsa-devel@alsa-project.org
Subject: Re: Too many snd_pcm_mmap_readi calls
Date: Wed, 07 May 2014 14:58:59 +0200 [thread overview]
Message-ID: <536A2E13.9070900@ladisch.de> (raw)
In-Reply-To: <536A026D.1070104@janhomann.de>
Jan Homann wrote:
> In my opinion mmap_begin just tells the alsa-lib that someone is about
> to access the buffer.
With mmap_begin, you ask the device how many frames are available in the
buffer (and get a pointer to them). With mmap_commit, you tell the
device how many frames you actually read.
> I am using mmap because of its good performance.
Using mmap makes sense only when you are accessing the samples in the
buffer directly. If you just copy the frames into your own buffer,
there is *no* difference whatsoever to snd_pcm_readi.
> Under normal condition with snd_pcm_mmap_readi my program uses about
> 1% of cpu-time where snd_pcm_readi uses about 75%.
It's likely that you do not correctly wait for frames being available
in your real program.
> Do you know a good tutorial about using mmap_readi?
This: use snd_pcm_readi instead.
Regards,
Clemens
next prev parent reply other threads:[~2014-05-07 12:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-07 7:18 Too many snd_pcm_mmap_readi calls Jan Homann
2014-05-07 9:01 ` Clemens Ladisch
2014-05-07 9:52 ` Jan Homann
2014-05-07 10:29 ` Jaroslav Kysela
2014-05-07 12:58 ` Clemens Ladisch [this message]
2014-05-13 7:25 ` Jan Homann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=536A2E13.9070900@ladisch.de \
--to=clemens@ladisch.de \
--cc=alsa-devel@alsa-project.org \
--cc=jh@janhomann.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox