From nobody Tue Feb 10 03:16:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1578129182; cv=none; d=zohomail.com; s=zohoarc; b=NOOzQIbqCIuCOkTs1PY4Qwyc031BjJ3Ypv4W4NouYjIOx8+2ihW64yUuMboM4WjXft/D+dy2QSRcwc/H4fu2MIvYldBL92lyergrg0RlrCuvVwiOxH1Z0IMOO2679ZstvKvhYRQIG4nKD2ngVYaDv/PfCkuaPny34JhHc4sbaEA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578129182; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OhXDPhKnRqH75QMWGx8RkZuxqrmfSWZf7CsRQp2FtwE=; b=O/9znNuu8GpSZ/gUMPoKQ1hcF+xfKBpb1SbCexZbyW33CqQILRSKDoX0Y0c3+v84tS0UtY2Dyc67I/SkuhZe6E+zSqX1uIwLfU3Mw/nmGv6T6k3FHMJDkj6bfaW0s6r2pAk+MHTAyeMytFbzozYiRlNE71PvoAs4aJ5lhDUxtlM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1578129182604960.8598789531596; Sat, 4 Jan 2020 01:13:02 -0800 (PST) Received: from localhost ([::1]:60830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1infUT-00038F-3c for importer@patchew.org; Sat, 04 Jan 2020 04:13:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34368) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1infTC-0001qR-5o for qemu-devel@nongnu.org; Sat, 04 Jan 2020 04:11:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1infTA-0007TL-R2 for qemu-devel@nongnu.org; Sat, 04 Jan 2020 04:11:42 -0500 Received: from mailout12.t-online.de ([194.25.134.22]:33140) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1infTA-0007NT-Jc for qemu-devel@nongnu.org; Sat, 04 Jan 2020 04:11:40 -0500 Received: from fwd21.aul.t-online.de (fwd21.aul.t-online.de [172.20.27.66]) by mailout12.t-online.de (Postfix) with SMTP id 30B6A41E652F; Sat, 4 Jan 2020 10:11:39 +0100 (CET) Received: from linpower.localnet (EZWeFBZfghF69dEMnIqJRorvOHbAgVQGZh4eOH2FBL4NRM7JDnFHVw+xIron87bgSS@[46.86.52.107]) by fwd21.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1infT2-0fp5CC0; Sat, 4 Jan 2020 10:11:32 +0100 Received: by linpower.localnet (Postfix, from userid 1000) id 2723E202791; Sat, 4 Jan 2020 10:11:22 +0100 (CET) From: =?UTF-8?q?Volker=20R=C3=BCmelin?= To: Gerd Hoffmann Subject: [PATCH v2 5/5] paaudio: wait until the recording stream is ready Date: Sat, 4 Jan 2020 10:11:22 +0100 Message-Id: <20200104091122.13971-5-vr_qemu@t-online.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <07d61da6-51fb-8599-ea27-dae828fbdb3c@t-online.de> References: <07d61da6-51fb-8599-ea27-dae828fbdb3c@t-online.de> MIME-Version: 1.0 X-ID: EZWeFBZfghF69dEMnIqJRorvOHbAgVQGZh4eOH2FBL4NRM7JDnFHVw+xIron87bgSS X-TOI-MSGID: adab2745-9ac0-43f4-9e76-d06ad377268a Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 194.25.134.22 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?q?Zolt=C3=A1n=20K=C5=91v=C3=A1g=C3=B3?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Don't call pa_stream_peek before the recording stream is ready. Information to reproduce the problem. Start and stop Audacity in the guest several times because the problem is racy. libvirt log file: -audiodev pa,id=3Daudio0,server=3Dlocalhost,out.latency=3D30000, out.mixing-engine=3Doff,in.mixing-engine=3Doff \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny, resourcecontrol=3Ddeny \ -msg timestamp=3Don : Domain id=3D4 is tainted: custom-argv char device redirected to /dev/pts/1 (label charserial0) audio: Device pcspk: audiodev default parameter is deprecated, please specify audiodev=3Daudio0 audio: Device hda: audiodev default parameter is deprecated, please specify audiodev=3Daudio0 pulseaudio: pa_stream_peek failed pulseaudio: Reason: Bad state pulseaudio: pa_stream_peek failed pulseaudio: Reason: Bad state Signed-off-by: Volker R=C3=BCmelin --- audio/paaudio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/audio/paaudio.c b/audio/paaudio.c index b23274550e..dbfe48c03a 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -162,6 +162,10 @@ static size_t qpa_read(HWVoiceIn *hw, void *data, size= _t length) =20 CHECK_DEAD_GOTO(c, p->stream, unlock_and_fail, "pa_threaded_mainloop_lock failed\n"); + if (pa_stream_get_state(p->stream) !=3D PA_STREAM_READY) { + /* wait for stream to become ready */ + goto unlock; + } =20 while (total < length) { size_t l; @@ -191,6 +195,7 @@ static size_t qpa_read(HWVoiceIn *hw, void *data, size_= t length) } } =20 +unlock: pa_threaded_mainloop_unlock(c->mainloop); return total; =20 --=20 2.16.4