ALSA: pcm: fix delta calculation at boundary wraparound
[deliverable/linux.git] / sound / core / pcm_lib.c
index 22aff180dd1f214a11b73264fe01c3957e582ac1..e9d98be190c58db786c53ea8adc9770bd808d5ec 100644 (file)
@@ -345,7 +345,9 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
                new_hw_ptr = hw_base + pos;
        }
       __delta:
-       delta = (new_hw_ptr - old_hw_ptr) % runtime->boundary;
+       delta = new_hw_ptr - old_hw_ptr;
+       if (delta < 0)
+               delta += runtime->boundary;
        if (xrun_debug(substream, in_interrupt ?
                        XRUN_DEBUG_PERIODUPDATE : XRUN_DEBUG_HWPTRUPDATE)) {
                char name[16];
This page took 0.025759 seconds and 5 git commands to generate.