summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker RĂ¼melin <vr_qemu@t-online.de>2022-10-22 13:51:15 +0200
committerFrediano Ziglio <freddy77@gmail.com>2022-10-22 20:58:02 +0100
commita5d1d957d6c16e3fe213e10d0cab4bfe2504ba91 (patch)
treef7e2ed7595eac08eb517bb8a23549badbf278a5c
parentc7b313ba31ebf02d7173551ee8dd6710b7676441 (diff)
sound: Fix pointer arithmetic in snd_record_handle_write()
The variable 'now' counts in audio sample frames, but the variable 'data' is of type uint8_t *. Multiply 'now' by the size of an audio sample frame to get the correct source pointer. This improves the quality of audio recordings in QEMU a little bit. Fixes: 5d5a7bd181 ("sound: Avoid cast that could cause alignment problems") Signed-off-by: Volker RĂ¼melin <vr_qemu@t-online.de> Acked-by: Frediano Ziglio <freddy77@gmail.com>
-rw-r--r--server/sound.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/server/sound.cpp b/server/sound.cpp
index eca2706c..4909d158 100644
--- a/server/sound.cpp
+++ b/server/sound.cpp
@@ -302,7 +302,7 @@ static bool snd_record_handle_write(RecordChannelClient *record_client, size_t s
memcpy(record_client->samples + write_pos, data, now << 2);
if (size) {
- memcpy(record_client->samples, data + now, size << 2);
+ memcpy(record_client->samples, data + (now << 2), size << 2);
}
if (record_client->write_pos - record_client->read_pos > RECORD_SAMPLES_SIZE) {