diff options
author | Volker RĂ¼melin | 2021-01-10 11:02:22 +0100 |
---|---|---|
committer | Gerd Hoffmann | 2021-01-15 11:25:22 +0100 |
commit | e02d178f78d7cff93c3c9b7e3c3ac6822c46c563 (patch) | |
tree | 278da57a4354b34a6a4ef0cd267af1d48a9c5ede | |
parent | sdlaudio: always clear the sample buffer (diff) | |
download | qemu-e02d178f78d7cff93c3c9b7e3c3ac6822c46c563.tar.gz qemu-e02d178f78d7cff93c3c9b7e3c3ac6822c46c563.tar.xz qemu-e02d178f78d7cff93c3c9b7e3c3ac6822c46c563.zip |
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 <vr_qemu@t-online.de>
Reviewed-by: Thomas Huth <thuth@redhat.com>
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 <kraxel@redhat.com>
-rw-r--r-- | audio/sdlaudio.c | 3 |
1 files changed, 2 insertions, 1 deletions
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); } } |