audio/oss: fix buffer pos calculation
Fixes:stable-4.23ba4066d08
("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> (cherry picked from commit7a4ede0047
) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
parent
9adb6569bf
commit
4b34c6d724
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue