[alsa-devel] XRUN happens too often.

Clemens Ladisch clemens at ladisch.de
Thu Apr 10 08:41:40 CEST 2008

Rong-Jhe wrote:
> buffer size = 9408 frames
> A sample in 16-bit, two channels is 4 bytes.
> I allocate a audio data of 9408x4=37632 bytes.
> audio_data=malloc(buffer_size*4);
> This audio_data buffer will receive audio data from the network.
> If this buffer is full, I use snd_pcm_writei( ) to put the buffer into the pcm.

When this buffer is full, the device buffer is completely empty,
and even the slightest delay will result in an underrun.

Write data to the device buffer immediately when you receive it.


More information about the Alsa-devel mailing list