At Wed, 22 Oct 2003 12:58:53 +0200 (CEST),
Jaroslav wrote:
> 
> On Tue, 21 Oct 2003, Takashi Iwai wrote:
> 
> > > > well, it's not unnecessary but too strict.
> > > > especially, if the hardware generates too late (often seen on onboard
> > > > chips), and if only two periods are used, this situation can happen.
> > > >
> > > > i think delta < (runtime->period_size/2) would be enough to check the
> > > > negative (invalid) hwptr rather than delta < (runtime->buffer_size/2)
> > > > as it is.
> > >
> > > Nope. This check will be wrong because we will fall to the wrap point and
> > > increase hw_ptr_base with buffer_size.
> >
> > the problem is that this check is too strict when only two periods are
> > used.  since buffer_size/2 == period_size, if the update of hwptr is
> > delayed even for one sample, it won't pass.
> >
> > there is a little difference between snd_pcm_update_hw_ptr() and
> > snd_pcm_update_hw_ptr_interrupt(), and this problem doesn't happen in
> > the former but only in the latter function, which is invoked by
> > snd_pcm_lib_write1().
> >
> > in the former function, delta is the difference between the expected
> > pointer (lastptr + period_size) and the current pointer.  meanwhile,
> > in the latter function, delta is the difference between the last
> > pointer and the new pointer.
> > hence, the calculation of delta in the latter function can be easily
> > less than buffer_size/2 when nperiods = 2.
> >
> > > Anyway, I think that we should leave the check as is for debugging
> > > purposes (we should know that something is failing).
> >
> > sure, it's harmless message (as long as it comes from
> > snd_pcm_update_hw_ptr()) but too annoying.  there are too many
> > sloppy hardwares...
> 
> I've tried to reduce the debugging output for some conditions where
> periods is a small value. In this case, it's really difficult to determine
> which pointer is bad.

thanks, the code looks better than my hack.

yes, it's difficult to guess the wrap in the case nperiods <= 2.
we must trust that interrupts are enough fast not to bring the
critical delays.


Takashi


-------------------------------------------------------
This SF.net email is sponsored by OSDN developer relations
Here's your chance to show off your extensive product knowledge
We want to know what you know. Tell us and you have a chance to win $100
http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to