On Wed, 17 Mar 2010, John Graham wrote: > Hi there, > > Can anyone suggest a good, clean way of handling xruns? I'm using ALSA > for an embedded platform (TX25 (ARM i.MX25 processor) using an > SGTL5000 - I2S audio) and sometimes my duplex audio stream goes > completely silent after an xrun. Then, after another xrun (or a > couple, or a few, or a lot...) audio returns. It looks like a bug in the driver. The audio should be recovered after each prepare() call. I would ask the author of driver what's wrong. > At the moment, to handle an xrun I call snd_pcm_drop() and > snd_pcm_prepare(). The only other thing I can think of to guarantee > the audio returns is to completely stop and restart the stream, but > I'd much rather find a better solution! > > If anyone could suggest how to go about this, I'd be very grateful. Application can choose between two methods: 1) enable xrun (set stop_threshold to buffer_size or less) - you are using this method now 2) disable xrun (set stop_threshold to boundary) If you disable xrun checking in the driver and if application does not update the ring buffer contents in time, the old samples from the ring buffer will be replayed (clicks). Additionaly to reduce clicks, you may force the driver to fill the ring buffer with silence - see silence_threshold). Jaroslav ----- Jaroslav Kysela <perex@xxxxxxxx> Linux Kernel Sound Maintainer ALSA Project, Red Hat, Inc. ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Alsa-user mailing list Alsa-user@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/alsa-user