* Question about snd_pcm_update_hw_ptr_post()
@ 2008-03-03 20:42 Timur Tabi
2008-03-04 7:27 ` Clemens Ladisch
0 siblings, 1 reply; 2+ messages in thread
From: Timur Tabi @ 2008-03-03 20:42 UTC (permalink / raw)
To: alsa-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Question about snd_pcm_update_hw_ptr_post()
2008-03-03 20:42 Question about snd_pcm_update_hw_ptr_post() Timur Tabi
@ 2008-03-04 7:27 ` Clemens Ladisch
0 siblings, 0 replies; 2+ messages in thread
From: Clemens Ladisch @ 2008-03-04 7:27 UTC (permalink / raw)
To: Timur Tabi; +Cc: alsa-devel
Timur Tabi wrote:
> 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?
Yes, it's the number of free frames that the application can write.
> If so, why is avail >= runtime->stop_threshold considered an underrun condition?
When too many frames in the buffer are free, there are not enough frames
available for the hardware to play.
The default value of the stop threshold is the size of the buffer, so an
underrun happens when the buffer has been completely emptied.
> how can I adjust runtime->stop_threshold?
snd_pcm_sw_params_current()
snd_pcm_sw_params_set_stop_threshold()
snd_pcm_sw_params()
HTH
Clemens
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-04 7:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-03 20:42 Question about snd_pcm_update_hw_ptr_post() Timur Tabi
2008-03-04 7:27 ` Clemens Ladisch
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.