From: MONTANARO Luciano (MM) Date: Tue, 4 Mar 2014 11:51:36 +0000 (+0100) Subject: pcm: Wrap hw_ptr to boundary in pcm_ioplug X-Git-Tag: v1.0.28~20 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=688004a6acf7d1d568a660546816a092b6cc32ed;p=alsa-lib.git pcm: Wrap hw_ptr to boundary in pcm_ioplug 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 Signed-off-by: Jaroslav Kysela --- diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c index a90c8445..c1c3a983 100644 --- a/src/pcm/pcm_ioplug.c +++ b/src/pcm/pcm_ioplug.c @@ -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;