[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 2/4] dsoundaudio: fix "Could not lock capture buffer" warning
From: |
Gerd Hoffmann |
Subject: |
[PULL 2/4] dsoundaudio: fix "Could not lock capture buffer" warning |
Date: |
Tue, 7 Apr 2020 11:22:04 +0200 |
From: Volker RĂ¼melin <address@hidden>
IDirectSoundCaptureBuffer_Lock() fails on Windows when called
with len = 0. Return early from dsound_get_buffer_in() in this
case.
To reproduce the warning start a linux guest. In the guest
start Audacity and you will see a lot of "Could not lock
capture buffer" warnings.
Signed-off-by: Volker RĂ¼melin <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
audio/dsoundaudio.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c
index 9e621c889954..a08d519cae6a 100644
--- a/audio/dsoundaudio.c
+++ b/audio/dsoundaudio.c
@@ -542,6 +542,11 @@ static void *dsound_get_buffer_in(HWVoiceIn *hw, size_t
*size)
req_size = audio_ring_dist(cpos, hw->pos_emul, hw->size_emul);
req_size = MIN(req_size, hw->size_emul - hw->pos_emul);
+ if (req_size == 0) {
+ *size = 0;
+ return NULL;
+ }
+
err = dsound_lock_in(dscb, &hw->info, hw->pos_emul, req_size, &ret, NULL,
&act_size, NULL, false, ds->s);
if (err) {
--
2.18.2