From f562b032be770b915166f888543c9f6e06b26544 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 14 Nov 2011 17:02:40 +0100 Subject: [PATCH] pcm:mmap_emul: Fix sw_params and others in bypass mode When the slave doesn't need any mmap-emulation, the plugin shouldn't do anything special in sw_params and other callbacks but just pass to the generic helpers and update hwptr and applptr. Signed-off-by: Takashi Iwai --- src/pcm/pcm_mmap_emul.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pcm/pcm_mmap_emul.c b/src/pcm/pcm_mmap_emul.c index f6e7ae93..664e9077 100644 --- a/src/pcm/pcm_mmap_emul.c +++ b/src/pcm/pcm_mmap_emul.c @@ -212,6 +212,9 @@ static int snd_pcm_mmap_emul_sw_params(snd_pcm_t *pcm, mmap_emul_t *map = pcm->private_data; int err; + if (!map->mmap_emul) + return snd_pcm_generic_sw_params(pcm, params); + map->start_threshold = params->start_threshold; /* HACK: don't auto-start in the slave PCM */ @@ -317,9 +320,9 @@ snd_pcm_mmap_emul_mmap_commit(snd_pcm_t *pcm, snd_pcm_uframes_t offset, mmap_emul_t *map = pcm->private_data; snd_pcm_t *slave = map->gen.slave; + snd_pcm_mmap_appl_forward(pcm, size); if (!map->mmap_emul) return snd_pcm_mmap_commit(slave, offset, size); - snd_pcm_mmap_appl_forward(pcm, size); if (pcm->stream == SND_PCM_STREAM_PLAYBACK) sync_slave_write(pcm); return size; @@ -332,10 +335,7 @@ static snd_pcm_sframes_t snd_pcm_mmap_emul_avail_update(snd_pcm_t *pcm) snd_pcm_sframes_t avail; avail = snd_pcm_avail_update(slave); - if (!map->mmap_emul) - return avail; - - if (pcm->stream == SND_PCM_STREAM_PLAYBACK) + if (!map->mmap_emul || pcm->stream == SND_PCM_STREAM_PLAYBACK) map->hw_ptr = *slave->hw.ptr; else sync_slave_read(pcm); -- 2.47.1