pcm - Limit the avail_min minimum size
authorTakashi Iwai <tiwai@suse.de>
Tue, 20 Nov 2007 14:29:10 +0000 (15:29 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 20 Nov 2007 14:29:10 +0000 (15:29 +0100)
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.

src/pcm/pcm.c

index 9ac132b..142b4c6 100644 (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;
 }