[alsa-devel] underruns and POLLERR when copying audio frames

pl bossart bossart.nospam at gmail.com
Mon Aug 2 05:02:36 CEST 2010

> For now I will just add buffering and hope that the buffer is big enough
>  so that there will be no xruns for reasonable long amounts of time.
> In case I get troubles anyway, is there some kind of way to synchronize
> clocks between the ALSA stack running on one system with the stack on
> another system ?

You cannot 'synchronize' clocks. The only option is to generate the
relevant number of samples to compensate for the drift.
This can be done by adding/dropping samples, time stretching or
fractional resampling (by order of complexity).
You may want to try gstreamer for this type of use cases (gst-launch
alsasrc ! alsasink), the drift between incoming and outgoing samples
is tracked and some configurable resampling can be done. Or
module-loopback in PulseAudio if it's installed on your system.

More information about the Alsa-devel mailing list