[alsa-devel] What does start_threshold mean, and what value should it contain?
tiwai at suse.de
Tue Apr 24 15:05:48 CEST 2007
At Mon, 23 Apr 2007 11:27:31 +0100,
j t wrote:
> I'm trying to debug a problem with xruns which happen when playing a
> wav file with vlc, but I can't reproduce the problems when using
> "aplay -M" to play the same wav file. (logged as
> I've checked the contents of /proc/asound/card0/pcm0p/sub0/ in both
> cases - they appear to be very similar except for the contents of
> sw_params: when I use vlc, start_threshold says 1, but when I use
> "aplay -M", start_threshold says 16384.
> So, what does start_threshold mean, is there a particular value that
> start_threshold "should" contain, and could this difference be the
> cause of the xruns? (The aplay man page doesn't seem to have any flags
> for controlling the value of this parameter, so it doesn't appear to
> be "user-configurable").
The stard_threshold defines the position of the automatic stream
start. Usually, the transfer (DMA) starts either manually or
automatically. The manual start is done via snd_pcm_start() at any
time. OTOH, when the data is filled up to the start_threshold
size, then the stream is automaticall started.
start_threshold = 1 is fairly dangerous setting because it means that
the stream starts as soon as any data is written. This causes often
XRUN because the least amount of data to be filled is the period size
on most hardwares. Thus, setting start_threshold = period_size or
buffer_size is the usual setting. The latter means to wait until the
whole buffer is fulled.
More information about the Alsa-devel