From patchwork Wed Apr 1 19:00:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Volker_R=C3=BCmelin?= X-Patchwork-Id: 11469477 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 90F09159A for ; Wed, 1 Apr 2020 19:04:35 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2B88E206F6 for ; Wed, 1 Apr 2020 19:04:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B88E206F6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=t-online.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:36150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJifC-0004cn-0n for patchwork-qemu-devel@patchwork.kernel.org; Wed, 01 Apr 2020 15:04:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58566) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJibA-0000T4-Fm for qemu-devel@nongnu.org; Wed, 01 Apr 2020 15:00:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJib9-0002Rm-1K for qemu-devel@nongnu.org; Wed, 01 Apr 2020 15:00:24 -0400 Received: from mailout09.t-online.de ([194.25.134.84]:45750) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJib8-0002R2-PN for qemu-devel@nongnu.org; Wed, 01 Apr 2020 15:00:22 -0400 Received: from fwd18.aul.t-online.de (fwd18.aul.t-online.de [172.20.26.244]) by mailout09.t-online.de (Postfix) with SMTP id 3CAF942D6891; Wed, 1 Apr 2020 21:00:21 +0200 (CEST) Received: from linpower.localnet (SgGN78ZYghq0L+ncI2t2vYTLp2j7LeBhONEwkPaRSgrPBB+UYmA+s1hGD4VQXnpgD3@[93.236.147.242]) by fwd18.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1jJib6-06E4fI0; Wed, 1 Apr 2020 21:00:20 +0200 Received: by linpower.localnet (Postfix, from userid 1000) id 5A5B620062A; Wed, 1 Apr 2020 21:00:17 +0200 (CEST) From: =?utf-8?q?Volker_R=C3=BCmelin?= To: Gerd Hoffmann Subject: [PATCH 2/3] dsoundaudio: fix "Could not lock capture buffer" warning Date: Wed, 1 Apr 2020 21:00:16 +0200 Message-Id: <20200401190017.5081-2-vr_qemu@t-online.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <19cd6a5a-97b7-b684-f026-11d82e34dab9@t-online.de> References: <19cd6a5a-97b7-b684-f026-11d82e34dab9@t-online.de> MIME-Version: 1.0 X-ID: SgGN78ZYghq0L+ncI2t2vYTLp2j7LeBhONEwkPaRSgrPBB+UYmA+s1hGD4VQXnpgD3 X-TOI-MSGID: c567f1f0-1cd0-4719-b0e6-bf99b2daab19 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 194.25.134.84 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QEMU , =?utf-8?b?Wm9sdMOhbiBLxZF2w6Fnw7M=?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 --- audio/dsoundaudio.c | 5 +++++ 1 file changed, 5 insertions(+) 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) {