[alsa-devel] safe support for rewind in ALSA
Raymond Yau
superquad.vortex2 at gmail.com
Mon Feb 15 04:03:36 CET 2010
2010/2/11 Jaroslav Kysela <perex at perex.cz>
> On Thu, 11 Feb 2010, Clemens Ladisch wrote:
>
> >> Do you mean that PA only wake up once when configure sound card to use
> two
> >> periods per buffer ?
> >
> > When using two periods per buffer, ALSA tries to wake up PA two times.
> > However, PA ignores the sound card's interrupts and is woken up by its
> > own timer.
>
> PA can drive the wake-ups using avail_min sw parameter. If this value is
> high enough, no userspace wake up is called, only interrupt is processed
> and internal ring buffer pointers in the driver are updated.
>
> Jaroslav
>
Even using a high resolution timer , the application still cannot achieve
latency better than the configured period size
For USB case , the driver cannot give accurate hw pointer position , hw
pointer increase in steps for the current implementation, (i.e. the graph is
a stepping fuction if you plot the position of hardware pointer against time
elasped ) .
This mean that the wake up time cannot be calculated using as number of
sample/rate since the fuction is not linear especially when using max buffer
size , min period --> max period size is much greater than the watermark
The glitch is most likely underrun,
Refer to
http://thread.gmane.org/gmane.linux.alsa.devel/60371/focus=60535
The delay value cannot be used for buffer filling, of course (also in
standard - no-XRUN case - avail functions should be used).
More information about the Alsa-devel
mailing list