diff mbox series

[PULL,06/30] sdlaudio: fill remaining sample buffer with silence

Message ID 20210115132146.1443592-7-kraxel@redhat.com (mailing list archive)
State New, archived
Headers show
Series [PULL,01/30] sdlaudio: remove leftover SDL1.2 code | expand

Commit Message

Gerd Hoffmann Jan. 15, 2021, 1:21 p.m. UTC
From: Volker RĂ¼melin <vr_qemu@t-online.de>

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>
---
 audio/sdlaudio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c
index 79eed23849ea..01ae4c600e80 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);
     }
 }