From: Clemens Ladisch <clemens@ladisch.de>
To: Pierre Vanhoucke <pierre.vanhoucke@skynet.be>
Cc: alsa-devel@alsa-project.org
Subject: Re: Alsa "short read" questions
Date: Fri, 21 Nov 2008 09:30:24 +0100 [thread overview]
Message-ID: <492671A0.9000907@ladisch.de> (raw)
In-Reply-To: <1227206298.7258.1.camel@pierre-desktop>
Pierre Vanhoucke wrote:
> 1. How is it possible to get a "short read" in blocking mode ?
> I would think that in blocking mode the control is only returned after
> the read is completed.
When an error occurs, you get the data that was read successfully before
the error. We wouldn't want to throw away this data just because an
error happened later. (This behaviour is for consistency with other
uses of read(); in the case of audio, throwing away some data wouldn't
actually hurt that much.)
> 2. What are the possible causes for a "short read" ?
Buffer overrun, USB device or SPDIF source unplugged, other errors.
> 3. What can be done to avoid a "short read" ?
You cannot prevent the user from unplugging a USB device, or the
administrator from suspending your program until the buffer overruns.
> 4. How am I supposed to recover from a "short read"?
Try to read the rest of that data that you wanted to read originally,
then you'll get the error code. (Or you'll get some data if the error
has vanished, but that is very unlikely.)
Best regards,
Clemens
prev parent reply other threads:[~2008-11-21 8:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-20 18:38 Alsa "short read" questions Pierre Vanhoucke
2008-11-21 8:30 ` 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=492671A0.9000907@ladisch.de \
--to=clemens@ladisch.de \
--cc=alsa-devel@alsa-project.org \
--cc=pierre.vanhoucke@skynet.be \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.