At Sat, 17 Nov 2007 17:59:53 +0300, Stas Sergeev wrote:
And above all, the fix would be really easy like the patch below.
Your patch works very well. Actually, much better than mine, for the reasons I can't explain (there is probably another similar loop somewhere, otherwise they would work in the similar way). Just a few questions:
- Do you want to "round" avail_min only
when it is < period_size, or maybe you want something like this instead:
avail_min += period_size - 1; avail_min -= avail_min % period_size;
so that it is always rounded up?
A good question. I'm a kind of conservative about that. avail_min itself doesn't guarantee the timing accuracy, so it's no driver/system problem even if the app is woken up slightly after the exact time.
But it's very unlikely that this round-up would break anything, though.
- What is it really good for? Why would
the one want avail_min != period_size? Now, after you disallow avail_min<period_size, it makes even less sense - why would someone set avail_min>period_size, instead of increasing the period_size itself? So maybe something like this is also possible:
/* there seem to be no reason to set avail_min,
- period_size is enough */
avail_min = period_size;
Changing period_size isn't allowed arbitrarilly because it's a hardware constraint. OTOH, avail_min is the software parameter. So avail_min > period_size makes sense in some cases. In my patch I disallowed the case avail_min < period_size because it doesn't work *practically*.
Then which version of mpg123 with which configuration?
But I am not sure if you tried _any_ mpg123 with any configuration. :)
Well, one of my versions on my machine has even no ALSA support.
thanks,
Takashi