]> git.alsa-project.org Git - alsa-lib.git/commitdiff
pcm: Wrap hw_ptr to boundary in pcm_ioplug
authorMONTANARO Luciano (MM) <luciano.montanaro@magnetimarelli.com>
Tue, 4 Mar 2014 11:51:36 +0000 (12:51 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 4 Mar 2014 12:02:29 +0000 (13:02 +0100)
The function snd_pcm_ioplug_hw_ptr_update() always increased the hw_ptr
by delta, without wrapping it to the boundary. This would lead to
problems when after many hours, the hw_ptr would overflow.

Signed-off-by: Luciano Montanaro <luciano.montanaro@magnetimarelli.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/pcm/pcm_ioplug.c

index a90c844598bdbb3c10f2d38008369f8bbdace463..c1c3a9835d47d7a1d50ba225a3d9d9d1eef79205 100644 (file)
@@ -60,7 +60,7 @@ static void snd_pcm_ioplug_hw_ptr_update(snd_pcm_t *pcm)
                        delta = hw - io->last_hw;
                else
                        delta = pcm->buffer_size + hw - io->last_hw;
-               io->data->hw_ptr += delta;
+               snd_pcm_mmap_hw_forward(io->data->pcm, delta);
                io->last_hw = hw;
        } else
                io->data->state = SNDRV_PCM_STATE_XRUN;