[alsa-devel] _mmap_playback_avail() short

Clemens Ladisch clemens at ladisch.de
Tue Nov 29 16:21:51 CET 2011


Alan Horstmann wrote:
> On Monday 28 November 2011 21:12, Clemens Ladisch wrote:
> > As a workaround, try snd_pcm_hw_params_set_periods_integer().
>
> Integer period for the pcm is actually already being set.

Strange; there's a bug somewhere ...

> Can you also explain how the non-integer period *size* is handled?

There are no non-integer period sizes.

> In the test case, dmix is set to 48000 with period 1024.  So at 44100 the
> rate conversion means the corresponding period size is 940.8.  I am not
> sure how that gets handled.  From the params dump giving period as (940 941)
> I had anticipated that a mixture of 4 * 941 and one 940 period would occur.
> However, what I see is that at a period boundary there is always just 940
> avail_frames - is that correct?

Have a look in /proc/asound/cardX/pcm0p/sub0/hw_params.

> How does that get converted to the 1024 frames at 48000?  Will there be
> irregular timing?

The rate plugin uses the proportion of the two period sizes for rate
conversion.  In your example, 940 samples are always converted into 1024
samples; the actual sample rate is 48000/1024*940 = 44062.5.


Regards,
Clemens


More information about the Alsa-devel mailing list