> compile NEMU

221220000 张三
Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
 15:11:09 up 4 days, 10:16,  1 user,  load average: 0.77, 0.69, 0.64
This commit is contained in:
tracer-ics2023
2024-09-21 15:11:10 +08:00
committed by zzy
parent 47ade0d465
commit fbb0a7b465

View File

@ -43,7 +43,7 @@ static void audio_callback(void *userdata, uint8_t *stream, int len) {
uint32_t read_cnt = MIN(count, len); uint32_t read_cnt = MIN(count, len);
uint32_t to_end_cnt = CONFIG_SB_SIZE - pos_read; uint32_t to_end_cnt = CONFIG_SB_SIZE - pos_read;
int32_t out_bound_cnt = read_cnt - to_end_cnt; int32_t out_bound_cnt = read_cnt - to_end_cnt;
memset(stream, 0, len); // memset(stream, 0, len);
if (out_bound_cnt > 0) { if (out_bound_cnt > 0) {
memcpy(stream, sbuf + pos_read, to_end_cnt); memcpy(stream, sbuf + pos_read, to_end_cnt);
memcpy(stream + to_end_cnt, sbuf, out_bound_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 += read_cnt;
pos_read %= CONFIG_SB_SIZE; 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; count -= read_cnt;
audio_count = count; audio_count = count;
mtx_unlock(&mtx_audio); mtx_unlock(&mtx_audio);