[alsa-devel] rate plugin issue

Takashi Iwai tiwai at suse.de
Tue Nov 13 04:20:27 CET 2007

At Mon, 12 Nov 2007 22:25:17 +0300,
Stas Sergeev wrote:
> Hello.
> Takashi Iwai wrote:
> > I committed your patch now on HG tree, as it's likely OK from the
> > possible breakage on other apps, too.
> OK, first I have to apologize for
> not providing a test-case - its still
> in my todo if you need it. There are
> still a few things unclear, like, for
> example, how it fixes the portaudio,
> if, as you say, such an apps are not
> touching the code in question.
> Anyway... as I said already, there are
> few more problems that were hidden
> before and are not any more. (I really
> tried to warn you :)
> For example, mpg123 will now consume
> 100% of CPU because of the nasty loop
> in snd_pcm_write_areas()...
> I am using something like the attached
> patch, but maybe you can come up with
> the better solution.
> Quick summary: mpg123 sets avail_min=1,
> so the loop spins without any rest.
> Before, the value was "adjusted", so
> it didn't spin that nasty way.

The problem is that the condition of poll() is indeed broken without
the hack.  That is, it's no problem of snd_pcm_write_areas().
snd_pcm_write_areas() just calls snd_pcm_wait(), which calls nothing
but poll().  If your program calls poll() by itself, you would see the
similar problem.

> > Anyway, I swear that I'll never read any mails during my next
> > vacation.  That was so exhausting to be dragged to a lengthy
> > discussion for band-aiding a badly designed compoment... :)
> But now, unfortunately, you won't get
> away from that. :)
> The hack used to cover more problems...

True, it should be fixed in a better way.



More information about the Alsa-devel mailing list