summaryrefslogtreecommitdiff
path: root/audio/ossaudio.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2020-01-20 11:18:04 +0100
committerGerd Hoffmann <kraxel@redhat.com>2020-01-31 08:47:55 +0100
commit7a4ede0047a8613b0e3b72c9d351038f013dd357 (patch)
treedb2131f0dceabc26ceed909d1046c1c87669a181 /audio/ossaudio.c
parent928173659d6e5dc368284f73f90ea1d129e1f57d (diff)
downloadqemu-7a4ede0047a8613b0e3b72c9d351038f013dd357.zip
audio/oss: fix buffer pos calculation
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>
Diffstat (limited to 'audio/ossaudio.c')
-rw-r--r--audio/ossaudio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index c43faeeea4..94564916fb 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -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;
}