Skip to content

Commit

Permalink
dsoundaudio: fix "Could not lock capture buffer" warning
Browse files Browse the repository at this point in the history
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>
Message-id: 20200405075017.9901-2-vr_qemu@t-online.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  • Loading branch information
Volker Rümelin authored and kraxel committed Apr 6, 2020
1 parent 4ba664c commit 1747029
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions audio/dsoundaudio.c
Expand Up @@ -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) {
Expand Down

0 comments on commit 1747029

Please sign in to comment.