summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2013-05-30 12:26:34 +0200
committerJaroslav Kysela <perex@perex.cz>2013-05-30 14:04:15 +0200
commitf2d39afe6139ab16aa2aeea0f51f32db79ab1262 (patch)
tree250cfedcec93a45f280e1fe54af04c71db1b8a5d
parent7f877543a36efd8fd5d38fae21352fc0567ece21 (diff)
downloadalsa-lib-f2d39afe6139ab16aa2aeea0f51f32db79ab1262.tar.gz
pcm_plugin: Fix return value of snd_pcm_rewind
In case the rewind did not rewind as much as expected, e g due to time delay between the latest avail update and the rewind, we must properly account for that in the plugin layer. Otherwise, the plugin's appl ptr and the hw's appl ptr become unsynchronised, which is very bad, especially in mmap_shadow plugins, e g, this could cause the overlapping memcpy in the softvol plugin as seen here: https://bugs.freedesktop.org/show_bug.cgi?id=64299 Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--src/pcm/pcm_plugin.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c
index 96218a8d..17157e87 100644
--- a/src/pcm/pcm_plugin.c
+++ b/src/pcm/pcm_plugin.c
@@ -219,9 +219,9 @@ static snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t
snd_atomic_write_end(&plugin->watom);
return sframes;
}
- snd_pcm_mmap_appl_backward(pcm, (snd_pcm_uframes_t) frames);
+ snd_pcm_mmap_appl_backward(pcm, (snd_pcm_uframes_t) sframes);
snd_atomic_write_end(&plugin->watom);
- return (snd_pcm_sframes_t) frames;
+ return (snd_pcm_sframes_t) sframes;
}
static snd_pcm_sframes_t snd_pcm_plugin_forwardable(snd_pcm_t *pcm)