summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-11-14 17:02:40 +0100
committerTakashi Iwai <tiwai@suse.de>2011-11-15 07:58:35 +0100
commitf562b032be770b915166f888543c9f6e06b26544 (patch)
treea71fb1b7da7c6a751bee833b7bf437c5fafe8146
parent15c6f832968c1f69a7c744f7051e4fc622acd62f (diff)
downloadalsa-lib-f562b032be770b915166f888543c9f6e06b26544.tar.gz
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 <tiwai@suse.de>
-rw-r--r--src/pcm/pcm_mmap_emul.c10
1 files 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);