All of lore.kernel.org
 help / color / mirror / Atom feed
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: 13 Feb 2003 15:36:23 -0800	[thread overview]
Message-ID: <1045179388.1986.196.camel@sprekhole> (raw)
In-Reply-To: <000001c2d3a2$a450b2f0$0100a8c0@Pblaptop>

On Thu, 2003-02-13 at 12:56, Pete Barnard wrote:
> :
> >
> > Does it always crash after the same time?
> 
> No. It didin't crash after the same time.  The problem is fixed now thanks
> to Josh Green's tip.   (I wrote a function that caught the EPIPE error and
> then did a snd_pcm_prepare). I left it for 2 nights with a system("date") in
> the catch function and got an EPIPE once on one night and not at all on the
> second night - so even though it is fixed I'm still slightly curious as to
> why I got this problem/feature at all.
> 
> Regards,
> 
> Pete
> 

Its due to your program not being able to meet the deadline for writing
an audio buffer for playback. This is often Linux kernel related and
there is lots of information about tuning your kernel (do a search for
"linux kernel low latency"). It can be somewhat of a black art, because
different hardware and Linux drivers can have adverse effects on
latency. For instance if your hard disk is IDE and isn't tuned right
(DMA not enabled for instance) you can get real long latency spikes when
reading/writing the hard disk. You'll also want to look into the lowlat
patch and perhaps the preempt patch as well. Kernels that come with
Linux distributions have a tendency to not be very low latency friendly,
so if you wan't low latency, build your own kernel with one of those
patches.

On your program side:
You can increase the audio buffer size and/or count to minimize
underruns (at the cost of higher latency audio playback).
If you require low latency, run your program with SCHED_FIFO scheduling
(see man sched_setscheduler, requires root privileges). Note that your
program then has the ability to lock up the machine, should it decide to
consume all the CPU time.

I think this is one of the main things that still needs to be solved
with Linux and audio. Low latency audio shouldn't entail buggy processes
being able to bring the system to its knees. Cheers.
	Josh Green



-------------------------------------------------------
This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your  SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en

  reply	other threads:[~2003-02-13 23: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 [this message]
2003-02-09  7:36 ` Josh Green

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=1045179388.1986.196.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.