diff mbox series

[2/3] dsoundaudio: fix "Could not lock capture buffer" warning

Message ID 20200401190017.5081-2-vr_qemu@t-online.de
State New
Headers show
Series DirectSound fixes for 5.0 | expand

Commit Message

Volker RĂ¼melin April 1, 2020, 7 p.m. UTC
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 <vr_qemu@t-online.de>
---
 audio/dsoundaudio.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c
index af70dd128e..ea1595dcd1 100644
--- a/audio/dsoundaudio.c
+++ b/audio/dsoundaudio.c
@@ -544,6 +544,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) {