-bugfix: fix qmp command migrate-set-parameters -some bugfixs about ARM hot-plugged CPUs -hw/core/machine:Fix the missing consideration of cluster-id -test/tcg:Fix target-specific Makefile variable path for user-mode -tests:add (riscv virt) machine mapping to testenv -Make a litte improvement in curl and hw/riscv -qemu support for loongarch -hw/pvrdma: Protect against buggy or malious guest driver -hw/audio/intel-hda:fix stream reset -dsoundaudio:fix crackling audio recordings -add notify-vm-exit support for i386 -blok-backend: prevent dangling BDS pointers across aio_poll() -net:Fix uninitialized data usage -net/eth:Don't consider ESP to be an IPv6 option header -hw/net/vmxnet3:Log guest-triggerable errors using LOG_GUEST_ERROR Signed-off-by: FeiXu <xufei30@huawei.com>
63 lines
2.2 KiB
Diff
63 lines
2.2 KiB
Diff
From b1985a8f51ce0496aa4e8802c42a64b90f1f891d Mon Sep 17 00:00:00 2001
|
|
From: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
|
|
Date: Tue, 21 Mar 2023 02:50:07 +0000
|
|
Subject: [PATCH] dsoundaudio: fix crackling audio recordings mainline
|
|
inclusion commit 9d90ceb27461d7d0d172fd941b812d511794a6c6 category: bugfix
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
---------------------------------------------------------------
|
|
|
|
Audio recordings with the DirectSound backend don't sound right.
|
|
A look a the Microsoft online documentation tells us why.
|
|
|
|
From the DirectSound Programming Guide, Capture Buffer Information:
|
|
'You can safely copy data from the buffer only up to the read
|
|
cursor.'
|
|
|
|
Change the code to read up to the read cursor instead of the
|
|
capture cursor.
|
|
|
|
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
|
|
Message-Id: <20211226154017.6067-2-vr_qemu@t-online.de>
|
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
|
Signed-off-by: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
|
|
---
|
|
audio/dsoundaudio.c | 7 +++----
|
|
1 file changed, 3 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c
|
|
index cfc79c129e..3dd2c4d4a6 100644
|
|
--- a/audio/dsoundaudio.c
|
|
+++ b/audio/dsoundaudio.c
|
|
@@ -536,13 +536,12 @@ static void *dsound_get_buffer_in(HWVoiceIn *hw, size_t *size)
|
|
DSoundVoiceIn *ds = (DSoundVoiceIn *) hw;
|
|
LPDIRECTSOUNDCAPTUREBUFFER dscb = ds->dsound_capture_buffer;
|
|
HRESULT hr;
|
|
- DWORD cpos, rpos, act_size;
|
|
+ DWORD rpos, act_size;
|
|
size_t req_size;
|
|
int err;
|
|
void *ret;
|
|
|
|
- hr = IDirectSoundCaptureBuffer_GetCurrentPosition(
|
|
- dscb, &cpos, ds->first_time ? &rpos : NULL);
|
|
+ hr = IDirectSoundCaptureBuffer_GetCurrentPosition(dscb, NULL, &rpos);
|
|
if (FAILED(hr)) {
|
|
dsound_logerr(hr, "Could not get capture buffer position\n");
|
|
*size = 0;
|
|
@@ -554,7 +553,7 @@ static void *dsound_get_buffer_in(HWVoiceIn *hw, size_t *size)
|
|
ds->first_time = false;
|
|
}
|
|
|
|
- req_size = audio_ring_dist(cpos, hw->pos_emul, hw->size_emul);
|
|
+ req_size = audio_ring_dist(rpos, hw->pos_emul, hw->size_emul);
|
|
req_size = MIN(*size, MIN(req_size, hw->size_emul - hw->pos_emul));
|
|
|
|
if (req_size == 0) {
|
|
--
|
|
2.27.0
|
|
|