[alsa-devel] XRUN happens too often.

Rong-Jhe r93922118 at ntu.edu.tw
Thu Apr 10 14:19:40 CEST 2008

Jaroslav Kysela <perex <at> perex.cz> writes:

> Nope, you probably use dmix plugin. This thread is only for management for 
> shared device and has nothing to do with sample transfers.
> 						Jaroslav

Sorry, I am confused with the mechanism of ALSA library.
I roughly viewed the implementation of snd_pcm_writei(). In my config, 
snd_pcm_writei() will call snd_pcm_mmap_writei().
In snd_pcm_mmap_writei(), the available space is checked, and will wait for 
available space if the pcm is in block mode and the space is not large enough.
Then snd_pcm_mmap_write_area() is called.
I think that snd_pcm_mmap_commit() do the work of put data into the buffer in 
user space.
Function snd_pcm_mmap_commit() shoud call snd_pcm_dmix_mmap_commit in my 
I saw snd_pcm_dmix_start_timer() here, and snd_pcm_dmix_start_timer() calls 
I don't know which file in ALSA driver will receive this ioctl system call.
Does this function start something like timer, and this timer will put the 
buffer in user space into the buffer in kernel space automatically?
I can't understand this mechanism.
I am confused with the interaction between ALSA library and ALSA driver.
I think the mixing procedure is implemented in user space, and ALSA driver 
only put the mixed buffer from user space to the soundcard.
Am I right?

More information about the Alsa-devel mailing list