From nobody Thu Nov 13 04:47:00 2025 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=1576786128; cv=none; d=zohomail.com; s=zohoarc; b=m76s1oOjNgns+DaoS46CuX1s1KwoWOM5ug60DK8Y8h39yMGjCBd909m9g0cgK6uQRx/Jt3rltV278sh+eF9zf/ZjmJpKrakW72rmM4E+VddFCJw2K64yC+CZna21DCOQKKlCvJpiRwi10IjKiDA2+U8Mto4PsXbjEK4+cjUg6fg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576786128; 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=Wvn5PKzIDDgrDrS09qZXRktIwEhlResdedpy7io52mc=; b=EQWzGIos0mIwmWKcAfLjsoH5DfntghiU1l4rT+THSoj+b2F9CMatq+uV9RJf066bIzgRnfmIB9RS03KquOPqUOKxxO48YMPQex65dfynlFN4G/2IYvnc+GR5GraIgJmVQzUqbkkKhohkyrpYNx7IcbjmUh5YUEH80VW4bdvRPqs= 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 1576786128873752.279003192332; Thu, 19 Dec 2019 12:08:48 -0800 (PST) Received: from localhost ([::1]:47370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii26J-00058P-F6 for importer@patchew.org; Thu, 19 Dec 2019 15:08:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37739) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii25T-0004Zn-Ab for qemu-devel@nongnu.org; Thu, 19 Dec 2019 15:07:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii25S-0000bV-7E for qemu-devel@nongnu.org; Thu, 19 Dec 2019 15:07:55 -0500 Received: from mailout03.t-online.de ([194.25.134.81]:54232) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ii25R-0000UY-UR for qemu-devel@nongnu.org; Thu, 19 Dec 2019 15:07:54 -0500 Received: from fwd13.aul.t-online.de (fwd13.aul.t-online.de [172.20.27.62]) by mailout03.t-online.de (Postfix) with SMTP id 5020342A320C; Thu, 19 Dec 2019 21:07:52 +0100 (CET) Received: from [192.168.211.200] (GD7AcuZrZhKODslQh75k-GKlCninl-DFx7aufMgAhtrGOegIiy71jnGYJEUxQ+Hwu3@[46.86.55.2]) by fwd13.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1ii25K-1F4MrY0; Thu, 19 Dec 2019 21:07:46 +0100 Subject: [PATCH 5/5] paaudio: wait until the recording stream is ready From: =?UTF-8?Q?Volker_R=c3=bcmelin?= To: Gerd Hoffmann References: Message-ID: Date: Thu, 19 Dec 2019 21:07:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: Content-Language: de-DE X-ID: GD7AcuZrZhKODslQh75k-GKlCninl-DFx7aufMgAhtrGOegIiy71jnGYJEUxQ+Hwu3 X-TOI-MSGID: 09e120e7-5a6c-4bea-960f-31fe89364f37 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.81 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+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 03cf10bb3c..bb4150bc34 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