aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel GAIO <mgaio35@gmail.com>2020-02-06 21:09:31 +0100
committerMiguel GAIO <mgaio35@gmail.com>2020-02-06 21:10:09 +0100
commit05c64c3d64b497ffaba5a78c12e8d0d33320b368 (patch)
treeb6f0d01d2e3c8a5952de42a55de46640d118806d
parentea9da6e1b16c14408b3bc5323cdc7560366bb943 (diff)
pcm: Set SW params.avail_min to period size
Using MMAP APIs, this parameter wake up application when 'avail_min' samples are availables. When audio processing expects exactly a full period size samples, the default parameter to 1 burns CPU until the full period available. Fix SW params.avail parameter to period size value. Signed-off-by: Miguel GAIO <mgaio35@gmail.com>
-rw-r--r--src/pcm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pcm.c b/src/pcm.c
index a32871e..c763d4c 100644
--- a/src/pcm.c
+++ b/src/pcm.c
@@ -409,7 +409,7 @@ int pcm_set_config(struct pcm *pcm, const struct pcm_config *config)
memset(&sparams, 0, sizeof(sparams));
sparams.tstamp_mode = SNDRV_PCM_TSTAMP_ENABLE;
sparams.period_step = 1;
- sparams.avail_min = 1;
+ sparams.avail_min = config->period_size;
if (!config->start_threshold) {
if (pcm->flags & PCM_IN)