From c9e23deb9219427045648f23c5a7e403865fde8a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 23 Jul 2009 16:21:08 +0200 Subject: [PATCH] ALSA: pcm - Fix hwptr buffer-size overlap bug The fix 5cec91b61b32e1f5cc7a6f41436405bea531f5b7 introduced another bug due to the missing offset for the overlapped hwptr. When the hwptr goes back to zero, the delta value has to be corrected with the buffer size. Otherwise this causes looping sounds. Signed-off-by: Takashi Iwai --- sound/core/pcm_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index d315f72949f46..72cfd47af6b8b 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -256,7 +256,7 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) delta = new_hw_ptr - hw_ptr_interrupt; } if (delta < 0) { - if (runtime->periods == 1) + if (runtime->periods == 1 || new_hw_ptr < old_hw_ptr) delta += runtime->buffer_size; if (delta < 0) { hw_ptr_error(substream, -- 2.39.5