[alsa-devel] _mmap_playback_avail() short
Clemens Ladisch
clemens at ladisch.de
Mon Nov 28 22:12:53 CET 2011
Alan Horstmann wrote:
>> It seems that at a period boundary event snd_pcm_mmap_playback_avail() may
>> not return a full period size, but is a few bytes short. If avail_min is
>> set to one whole period (which Portaudio at present does),
>> snd_pcm_direct_poll_revents() zeroes the revent due to the check of
>> snd_pcm_mmap_playback_avail() against avail_min. POLLOUT is therefore not
>> indicated, and the app does not write any data, causing an Xrun.
This sounds like a bug in the rate plugin. snd_pcm_rate_sync_hwptr()
tries to properly align pointer values at period boundaries, but its
algorithm doesn't work when a period does not start at the buffer start
(i.e., when the number of periods is not an integer), and this
restriction is not actually enforced by snd_pcm_rate_hw_refine_cchange().
As a workaround, try snd_pcm_hw_params_set_periods_integer().
Regards,
Clemens
More information about the Alsa-devel
mailing list