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
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to