alsaloop: fix the avail_min setup

The previous code does not work as expected for some period_size
configurations. We do not rely on the period size value, so do not
correlate the avail_min parameter with this value.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2012-05-13 13:24:01 +02:00
parent 6bbeb78dba
commit b72e221aab

View file

@ -246,15 +246,11 @@ static int setparams_set(struct loopback_handle *lhandle,
} else { } else {
if (lhandle == lhandle->loopback->play) { if (lhandle == lhandle->loopback->play) {
val = bufsize + bufsize / 2; val = bufsize + bufsize / 2;
if (val < (period_size * 3) / 4)
val = (period_size * 3) / 4;
if (val > (buffer_size * 3) / 4) if (val > (buffer_size * 3) / 4)
val = (buffer_size * 3) / 4; val = (buffer_size * 3) / 4;
val = buffer_size - val; val = buffer_size - val;
} else { } else {
val = bufsize / 2; val = bufsize / 2;
if (val < period_size / 2)
val = period_size / 2;
if (val > buffer_size / 4) if (val > buffer_size / 4)
val = buffer_size / 4; val = buffer_size / 4;
} }