[pulseaudio-discuss] alsa-sink: snd_pcm_avail() returns a huge value...but not alsa's bug

Wang Xingchao wangxingchao2011 at gmail.com
Mon Aug 22 06:52:25 PDT 2011

Hi all,

i see there's message like "snd_pcm_avail() returned  a value that's
is exceptionally large...", and pulseaudio regard that as ALsa's bug.
Take playback as example, i checked the code in alsa kernel, the code
looks like:

 *  result is: 0 ... (boundary - 1)
static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct
snd_pcm_runtime *runtime)
	snd_pcm_sframes_t avail = runtime->status->hw_ptr +
runtime->buffer_size - runtime->control->appl_ptr;
	if (avail < 0)
		avail += runtime->boundary;
	else if ((snd_pcm_uframes_t) avail >= runtime->boundary)
		avail -= runtime->boundary;
	return avail;

the boundary variable is initialized as a huge value, hence the logic
becomes, when appl_ptr goes ahead hw_ptr more than buffer_size, there
will hit the issue, the return value becomes huge.


More information about the pulseaudio-discuss mailing list