[alsa-devel] Question about snd_pcm_update_hw_ptr_post()

Timur Tabi timur at freescale.com
Mon Mar 3 21:42:45 CET 2008


Can someone explain to me this snippet from snd_pcm_update_hw_ptr_post():

if (avail >= runtime->stop_threshold) {
	if (substream->runtime->status->state == SNDRV_PCM_STATE_DRAINING)
		snd_pcm_drain_done(substream);
	else
		xrun(substream);
	return -EPIPE;
}

During playback, avail = snd_pcm_playback_avail().  Does this mean that avail is
number of frames available in the playback DMA buffer for new data?

If so, why is avail >= runtime->stop_threshold considered an underrun condition?
 Does ALSA try to keep the amount of available data to a minimum?

If so, how can I adjust runtime->stop_threshold?  I'd like to see what happens
if I make stop_threshold equal to the size of my DMA buffer.

-- 
Timur Tabi
Linux kernel developer at Freescale


More information about the Alsa-devel mailing list