From: Clemens Ladisch <clemens@ladisch.de>
To: Irfan Shaikh <irfan.shaikh@sasken.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"bahathir@gmail.com" <bahathir@gmail.com>
Subject: Re: Underrun
Date: Tue, 01 Mar 2011 14:42:47 +0100 [thread overview]
Message-ID: <4D6CF7D7.2030509@ladisch.de> (raw)
In-Reply-To: <16F32A3F9AF4E441B752BCD79C151ACA69D0BB5665@EXGMBX01.sasken.com>
Irfan Shaikh wrote:
> I am getting many under-run in my audio capture and playback application.
>
> 1) My CAPTURE buffer is of 1024 * 8 (Period size * no of periods), PLAYBACK buffer is of (512 * 16)
> 2) I try to read 8 K frames each time and write returned frames to playback device.
If you wait until the capture buffer is full, it's likely that you
get over/underruns at this moment. You have to do the processing in
smaller chunks.
Typically, in loops like this, the normal state is that the capture
buffer is almost empty, and the playback buffer almost full. You read
one period from the capture buffer (waiting for it if necessary),
process it, and write it to the playback buffer. You need at least two
period per buffer so that one can be captured/played while the other one
is being processed, and maybe more periods as safety against delays.
> B) Can i use snd_pcm_prepare() twice in two consecutive lines
Yes (if the driver isn't buggy).
Regards,
Clemens
> SASKEN BUSINESS DISCLAIMER: ...
EVEN MORE IMPORTANT DISCLAIMER:
This e-mail contains public information intended for any subscriber of
this mailing list and for anybody else who bothers to read it; it will
be copied, disclosed and distributed to the public. If you think you
are not the intended recipient, please commit suicide immediately.
These terms apply also to any e-mails quoted in, referenced from, or
answering this e-mail, and supersede any disclaimers in those e-mails.
Additionally, disclaimers in those e-mails will incur legal processing
fees of $42 per line; you have agreed to this by reading this disclaimer.
prev parent reply other threads:[~2011-03-01 13:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-01 5:59 Underrun Irfan Shaikh
2011-03-01 13:42 ` Clemens Ladisch [this message]
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=4D6CF7D7.2030509@ladisch.de \
--to=clemens@ladisch.de \
--cc=alsa-devel@alsa-project.org \
--cc=bahathir@gmail.com \
--cc=irfan.shaikh@sasken.com \
/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;
as well as URLs for NNTP newsgroup(s).