From fbb0a7b465cc5f8634f06f42d2074b8c0d2749fd Mon Sep 17 00:00:00 2001 From: tracer-ics2023 Date: Sat, 21 Sep 2024 15:11:10 +0800 Subject: [PATCH] =?UTF-8?q?>=20=20compile=20NEMU=20221220000=20=E5=BC=A0?= =?UTF-8?q?=E4=B8=89=20Linux=20zzy=205.15.146.1-microsoft-standard-WSL2=20?= =?UTF-8?q?#1=20SMP=20Thu=20Jan=2011=2004:09:03=20UTC=202024=20x86=5F64=20?= =?UTF-8?q?x86=5F64=20x86=5F64=20GNU/Linux=20=2015:11:09=20up=204=20days,?= =?UTF-8?q?=2010:16,=20=201=20user,=20=20load=20average:=200.77,=200.69,?= =?UTF-8?q?=200.64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nemu/src/device/audio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nemu/src/device/audio.c b/nemu/src/device/audio.c index 8a43506..c63b02b 100644 --- a/nemu/src/device/audio.c +++ b/nemu/src/device/audio.c @@ -43,7 +43,7 @@ static void audio_callback(void *userdata, uint8_t *stream, int len) { uint32_t read_cnt = MIN(count, len); uint32_t to_end_cnt = CONFIG_SB_SIZE - pos_read; int32_t out_bound_cnt = read_cnt - to_end_cnt; - memset(stream, 0, len); + // memset(stream, 0, len); if (out_bound_cnt > 0) { memcpy(stream, sbuf + pos_read, to_end_cnt); memcpy(stream + to_end_cnt, sbuf, out_bound_cnt); @@ -52,7 +52,7 @@ static void audio_callback(void *userdata, uint8_t *stream, int len) { } pos_read += read_cnt; pos_read %= CONFIG_SB_SIZE; - // if (len > read_cnt) memset(stream + read_cnt, 0, len - read_cnt); + if (len > read_cnt) memset(stream + read_cnt, 0, len - read_cnt); count -= read_cnt; audio_count = count; mtx_unlock(&mtx_audio);