39 lines
1.2 KiB
Diff
39 lines
1.2 KiB
Diff
|
From aba87e509898ec9ddb3e319267d7c267409ff100 Mon Sep 17 00:00:00 2001
|
||
|
From: Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
|
||
|
Date: Tue, 23 Nov 2010 08:47:08 -0600
|
||
|
Subject: [PATCH 10/10] pcm_plugin: fix delay
|
||
|
|
||
|
PulseAudio ALSA modules report errors after calling
|
||
|
snd_pcm_avail_delay(), with a delay lower than the number of samples
|
||
|
available.
|
||
|
|
||
|
Correct delay using Jaroslav's recommendation:
|
||
|
"the result should be 'delay(slave) + mmap_capture_avail(pcm)"
|
||
|
|
||
|
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
|
||
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||
|
---
|
||
|
src/pcm/pcm_plugin.c | 6 ++++++
|
||
|
1 files changed, 6 insertions(+), 0 deletions(-)
|
||
|
|
||
|
diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c
|
||
|
index 19d0dee..d88e117 100644
|
||
|
--- a/src/pcm/pcm_plugin.c
|
||
|
+++ b/src/pcm/pcm_plugin.c
|
||
|
@@ -144,6 +144,12 @@ static int snd_pcm_plugin_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
||
|
int err = snd_pcm_delay(plugin->gen.slave, &sd);
|
||
|
if (err < 0)
|
||
|
return err;
|
||
|
+ if (pcm->stream == SND_PCM_STREAM_CAPTURE &&
|
||
|
+ pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED &&
|
||
|
+ pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) {
|
||
|
+ sd += snd_pcm_mmap_capture_avail(pcm);
|
||
|
+ }
|
||
|
+
|
||
|
*delayp = sd;
|
||
|
return 0;
|
||
|
}
|
||
|
--
|
||
|
1.7.3.1
|
||
|
|