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 11:01:56 +0200 [thread overview]
Message-ID: <5369F684.7060502@ladisch.de> (raw)
In-Reply-To: <5369DE58.30208@janhomann.de>
Jan Homann wrote:
> while(1) {
> sleep(1);
> snd_pcm_wait( pcm_handle, REC_BUFFER_ELEMENT_SIZE_MS + 10);
> snd_pcm_mmap_begin(pcm_handle, &my_areas, &offset, &frames);
> snd_pcm_avail_update ( pcm_handle );
> snd_pcm_mmap_readi( pcm_handle, network_data.data_UC, ALSA_READ_FRAMES);
> snd_pcm_mmap_commit(pcm_handle, offset, frames);
> }
The sleep will result in an overrun, which will throw off the timing
of all following calls.
You are not checking the return value of any of these functions.
Why are you calling snd_pcm_avail_update? And why are you doing this
_after_ calling mmap_begin?
You are ignoring the number of frames returned by mmap_begin. This
value could be smaller or larger than ALSA_READ_FRAMES.
Why are you using mmap in the first place, when you don't even try to
access the buffer directly?
Regards,
Clemens
next prev parent reply other threads:[~2014-05-07 9:01 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 [this message]
2014-05-07 9:52 ` Jan Homann
2014-05-07 10:29 ` Jaroslav Kysela
2014-05-07 12:58 ` Clemens Ladisch
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=5369F684.7060502@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