pcm - Limit the avail_min minimum size

Fix avail_min if it's less than period_size.  The too small avail_min
is simply useless and the cause of CPU hog with rate plugin.
This commit is contained in:
Takashi Iwai 2007-11-20 15:29:10 +01:00
parent 1cf37d72c4
commit b0b7d0280f

View file

@ -5577,6 +5577,12 @@ int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params,
#endif
{
assert(pcm && params);
/* Fix avail_min if it's below period size. The period_size
* defines the minimal wake-up timing accuracy, so it doesn't
* make sense to set below that.
*/
if (val < pcm->period_size)
val = pcm->period_size;
params->avail_min = val;
return 0;
}