Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: louis@museresearch.com
To: Clemens Ladisch <clemens@ladisch.de>
Cc: alsa-devel@alsa-project.org, louis@museresearch.com
Subject: Re: Handling non-buffer-sized MMAP requests
Date: Fri, 17 Dec 2010 10:56:28 -0800	[thread overview]
Message-ID: <6d88c8ff7e2badeb57f085af0e782dac.squirrel@master.museresearch.com> (raw)
In-Reply-To: <4D05DFB9.3080407@ladisch.de>

Hi Clemens,
  Thanks for your reply

>> routine.  ALSA sometimes reports more samples available for input than
>> my
>> buffer can take, or asks for more samples than I have available.  Is
>> this
>> a buffer overrun/underrun?
>
> Yes.  (And this should happen only when you've disabled stopping on
> an xrun, so you've asked for it.  :-)

Ok, I found some old code which was enabling this behavior.  However, when
I took it out, I was still getting more input requests from ALSA than I
would expect (e.g. I expect in, out, in out, etc.  I get something like
in, out, in, in, out sometimes).  I am calling snd_pcm_link, which should
make the requests go in the correct order, right?

>> If I restart the streams in the case that too
>> much input is available (on the assumption that it's an xrun) it seems
>> to
>> happen at the drop of a hat and makes things worse.  If I discard the
>> excess input, that doesn't work well either.
>>
>> What is the appropriate way to deal with this situation?
>
> The best way would be to prevent this situation from happening, i.e.,
> read the captured data from the buffer before it overflows.

I'm not sure what you mean here.  I thought the whole reason it was
overflowing was that the CPU was too slow to keep up with the demand. 
What is the alternative?

> (In the case of capturing, latency does _not_ depend on the buffer size,
> so you should make the buffer as big as possible.)

Could you elaborate on this?  How does the input buffer work if the size
has no effect on the latency?

Thanks for your time,
Louis

  reply	other threads:[~2010-12-17 18:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-09 21:34 Handling non-buffer-sized MMAP requests louis
2010-12-13  8:56 ` Clemens Ladisch
2010-12-17 18:56   ` louis [this message]
2010-12-18  0:32   ` Raymond Yau

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=6d88c8ff7e2badeb57f085af0e782dac.squirrel@master.museresearch.com \
    --to=louis@museresearch.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.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