qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 06/23] sdlaudio: fill remaining sample buffer with silence


From: Thomas Huth
Subject: Re: [PATCH 06/23] sdlaudio: fill remaining sample buffer with silence
Date: Thu, 14 Jan 2021 17:58:21 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.3

On 10/01/2021 11.02, Volker Rümelin wrote:
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>
---
  audio/sdlaudio.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

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);
      }
  }

Ignorant question: Is anybody still using unsigned samples in the 21st century?

Anyway,
Reviewed-by: Thomas Huth <thuth@redhat.com>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]