]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
audio/oss: fix buffer pos calculation
authorGerd Hoffmann <kraxel@redhat.com>
Mon, 20 Jan 2020 10:18:04 +0000 (11:18 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 31 Jan 2020 07:47:55 +0000 (08:47 +0100)
Fixes: 3ba4066d085f ("ossaudio: port to the new audio backend api")
Reported-by: ziming zhang <ezrakiez@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20200120101804.29578-1-kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
audio/ossaudio.c

index c43faeeea4aa208c9729cc760dcd129705d5521d..94564916fbf03c4783a5fdf5c4031336757f16c8 100644 (file)
@@ -420,7 +420,7 @@ static size_t oss_write(HWVoiceOut *hw, void *buf, size_t len)
             size_t to_copy = MIN(len, hw->size_emul - hw->pos_emul);
             memcpy(hw->buf_emul + hw->pos_emul, buf, to_copy);
 
-            hw->pos_emul = (hw->pos_emul + to_copy) % hw->pos_emul;
+            hw->pos_emul = (hw->pos_emul + to_copy) % hw->size_emul;
             buf += to_copy;
             len -= to_copy;
         }