[alsa-devel] DMix period_size should always be half of buffer size?

Prabhu Sivaraja prabhu.sivaraja at gmail.com
Fri May 4 00:50:19 CEST 2007


This is a followup to my earlier question about dmix not being able to mix
small files. I investigated it more and here is what I found.

Again background info.
I have a 64KB as kernel buffer and a 64KB circular buffer for my device. In
a poll thread I copy the data obtained from ALSA lib from the kernel buffer
to my device circular buffer by keeping track of appl_ptr and hw_ptr(dmix
only). Everything was working fine except when I was trying to mix files
smaller than 64KB(my buffer size), the small file was not getting mixed
through the dmix plugin. Anything over 64KB was getting mixed just fine. So
I set about reducing my period size from 32KB to 4KB while maintaining my
buffer size at 64KB.

When I tried to do this my hw_ptr never gets incremented from 0. Hence my
driver is stuck in a loop waiting for bytes to copy. This is only observed
when I am using dmix plugin and NOT when using hw or plughw. When my period
size is half the size of my buffer everything works fine with dmix (I
verified this by reducing my buffer size to 8KB and making my period size
4KB. hw_ptr gets incremented then but I get buffer problems). It seems like
dmix is forcing me to keep my period size half the size of my buffer. hw and
plughw devices do not seem to do that.

Is this a limitation of dmix. Could anyone comment on the dmix limitation
that I am experiencing.

Thanks a lot of all your help.

Prabhu.


More information about the Alsa-devel mailing list