[alsa-devel] underruns and strange code in pcm_rate.c

Takashi Iwai tiwai at suse.de
Thu Nov 8 07:17:23 CET 2007


At Thu, 08 Nov 2007 12:05:21 +0300,
Stas Sergeev wrote:
> 
> Hello.
> 
> Takashi Iwai wrote:
> > Yeah I've seen the problem,
> Grrr... so you reproduced the
> problem already, right?

But still not exactly sure whether it's the same as you've got.
It's no good testcase after all, you see?

> > but as I wrote, it's basically because you
> > use periods=2 and unaligned sample rates.
> I do not - maybe libao does, but in
> fact I am sure also the sound servers
> have the same problem.

You didn't set the slave period_size and periods properly in your
configuration.  This defines periods=2 eventually.

> > So, of course, it doesn't work.
> It does - have you tried my patch?

It works casually until a certain point.  But XRUN shall happen, as I
explained.  So, the patch helps well but not cures completely as long
as you use that configuration.

> > 	slave.periods 3
> > 	slave.period_size 4096
> > then you'll hear the improvement, I guess.
> So you already tried everything - then
> why asking me for the test-case?

Because ogg123 is not the good way to understand the bug.
It has a middle layer, threading, and so on.

A testcase is the standard way to debug.  I don't like XP particularly
but some of its concept is benifitable for normal programming, too...

> Anyway. There is a bug. And not the
> only one. You knew the workaround
> while I was searching for the fix.
> Now you decide what is better - fix
> it or apply to workarounds.

Sigh.  A bug is a bug.  I know.  But, the problem is that the
configuration still doesn't work.  I'll likely apply your patch soon
later, but I need a better way to check.

> Btw, I can still reproduce the underrun
> by rapidly switching the consoles, even
> though now it is harder to reproduce.

This is utterly another problem, rather than the real-time response
issue.  Because the realtime responsiveness is important for two
period case, slight difference of period/buffer size or its wakeup
condition influences greatly on the behavior.


Takashi


More information about the Alsa-devel mailing list