From: Josh Green <jgreen@users.sourceforge.net>
To: Pete Barnard <petebarnard@tiscali.co.uk>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: Broken pipe mystery
Date: 08 Feb 2003 23:36:45 -0800 [thread overview]
Message-ID: <1044776209.1992.7.camel@sprekhole> (raw)
In-Reply-To: <058801c2cf5b$d4f1dfb0$0100a8c0@Pblaptop>
On Sat, 2003-02-08 at 02:21, Pete Barnard wrote:
> I am using ALSA 0.9.0rc7 and Red Hat Linux 7.2. My sound card is a CS461x.
> My computer is a reasonably powerful beast with 512M of RAM and 1Gig clock
> speed.
> I have written a simple capture program which reads interleaved samples from
> the sound card and goes around in a continuous while(1) loop. My program
> works perfectly - until it crashes after several hours with the message:
>
> "read from audio interface failed: broken pipe".
>
> I have narrowed it down to the following piece of code. The size of buf is 256 (shorts). Why would the snd_pcm_readi suddenly (randomly?) fail with a broken pipe??? Any ideas or suggestions would be greatly appreciated as I'm struggling with this
> annoying (and difficult to debug) problem.
>
> Regards,
>
> Pete
>
> while (1)
> {
> if ((err = snd_pcm_readi(capture_handle,buf,128)) != 128
> {
> // this is where it fails after several hours of working
> successfully
> cout << "read from audio interface failed: " << snd_strerror(err) <<
> endl;
> exit(1);
> }
> }
>
If I remember correctly the EPIPE error code is returned when an xrun
occurs. In the case of a read it would be a buffer overrun. Your code
should check for this return value and I believe you have to start the
stream again with "snd_pcm_prepare". Check out the ALSA site for HOWTOs
and the like. Cheers.
Josh Green
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
prev parent reply other threads:[~2003-02-09 7:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-08 10:21 Broken pipe mystery Pete Barnard
2003-02-08 11:13 ` tomasz motylewski
2003-02-08 13:56 ` Pete Barnard
2003-02-10 7:47 ` tomasz motylewski
2003-02-13 20:56 ` Pete Barnard
2003-02-13 23:36 ` Josh Green
2003-02-09 7:36 ` Josh Green [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=1044776209.1992.7.camel@sprekhole \
--to=jgreen@users.sourceforge.net \
--cc=alsa-devel@lists.sourceforge.net \
--cc=petebarnard@tiscali.co.uk \
/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.