From: Volker RĂ¼melin Date: Sun, 10 Jan 2021 10:02:22 +0000 (+0100) Subject: sdlaudio: fill remaining sample buffer with silence X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=e02d178f78d7cff93c3c9b7e3c3ac6822c46c563;p=qemu.git sdlaudio: fill remaining sample buffer with silence Fill the remaining sample buffer with silence. To fill it with zeroes is wrong for unsigned samples because this is silence with a DC bias. Signed-off-by: Volker RĂ¼melin Reviewed-by: Thomas Huth Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-6-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index 79eed23849..01ae4c600e 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -235,7 +235,8 @@ static void sdl_callback (void *opaque, Uint8 *buf, int len) /* clear remaining buffer that we couldn't fill with data */ if (len) { - memset(buf, 0, len); + audio_pcm_info_clear_buf(&hw->info, buf, + len / hw->info.bytes_per_frame); } }