From nobody Sun May 19 10:57:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=reject dis=none) header.from=hostfission.com ARC-Seal: i=1; a=rsa-sha256; t=1592109823; cv=none; d=zohomail.com; s=zohoarc; b=jih5ys7WCU7/vGtY6v4F4PQFDhVKD8xBdd6+i4ub6GJbH0xZHuOwANWsMpCZv82/0MtWuSNBKth9019baPGQMFBln67+xqEcAha9+THmBJ3XfvVd3nk1Qa2UX/yqyCmIvd9dGtex8iyGWNoATv0jYz22TStr7EjmlolQv2TDiwY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592109823; h=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=kOUUj6+wMUMPTrkoBypdrikcBCbUsuzxkmZ2BPOhY8s=; b=HhtuazJqMJqR0XO7J62MXQXd6QgCnMxLDd8sLdXtLXIWycqfwq3Plesvchdk03Q8oz9fCHHuoWt8bYBs7o+NsLiWWORxYAE51VqC8TE3IUJR/zqFAhtdYu3kZI0rIGEA6XfmEnsyVEkoD4NG2G8qQcfgBhw9Yjv0kVe837xHA9I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592109823178207.39350259668709; Sat, 13 Jun 2020 21:43:43 -0700 (PDT) Received: from localhost ([::1]:41636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkKUf-0006Nx-KH for importer@patchew.org; Sun, 14 Jun 2020 00:43:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35842) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jkKTd-0004jC-B0 for qemu-devel@nongnu.org; Sun, 14 Jun 2020 00:42:37 -0400 Received: from mail1.hostfission.com ([139.99.139.48]:57380) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkKTa-0005Av-OZ for qemu-devel@nongnu.org; Sun, 14 Jun 2020 00:42:37 -0400 Received: from moya.office.hostfission.com (office.hostfission.com [220.233.29.71]) by mail1.hostfission.com (Postfix) with ESMTP id 46503445D3; Sat, 13 Jun 2020 14:06:01 +1000 (AEST) Received: by moya.office.hostfission.com (Postfix, from userid 0) id 2EA0F3A0506; Sat, 13 Jun 2020 14:06:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hostfission.com; s=mail; t=1592021161; bh=4UNyzqKwA72Hv2rXe7+67R0tuH+ZT6vZbiRtOXthWWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ES+GokTHDTwJo8TsehcaBH4pYPjLkE0pnv2y4ByexEJa6bSLzqVcEFVDNv+s9GyJS OTuF9/h5/CYbAJvkbTJww1e2W+biI6DQW0ZZn8wizZkN5JpptibPNyF1GCXEm6DYXc 3wNravGdQjJtaXtD0h8Ocn6B8XEcuBOFdk0rHyBQ= From: Geoffrey McRae To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, geoff@hostfission.com Subject: [PATCH 1/6] audio/jack: fix invalid minimum buffer size check Date: Sat, 13 Jun 2020 14:05:13 +1000 Message-Id: <20200613040518.38172-2-geoff@hostfission.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200613040518.38172-1-geoff@hostfission.com> References: <20200613040518.38172-1-geoff@hostfission.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: none client-ip=139.99.139.48; envelope-from=root@moya.office.hostfission.com; helo=mail1.hostfission.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/13 00:05:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @hostfission.com) Content-Type: text/plain; charset="utf-8" JACK does not provide us with the configured buffer size until after activiation which was overriding this minimum value. JACK itself doesn't have this minimum limitation, but the QEMU virtual hardware and as such it must be enforced, failure to do so results in audio discontinuities. Signed-off-by: Geoffrey McRae --- audio/jackaudio.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/audio/jackaudio.c b/audio/jackaudio.c index 722ddb1dfe..d0b6f748f2 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -434,17 +434,6 @@ static int qjack_client_init(QJackClient *c) jack_set_xrun_callback(c->client, qjack_xrun, c); jack_on_shutdown(c->client, qjack_shutdown, c); =20 - /* - * ensure the buffersize is no smaller then 512 samples, some (all?) q= emu - * virtual devices do not work correctly otherwise - */ - if (c->buffersize < 512) { - c->buffersize =3D 512; - } - - /* create a 2 period buffer */ - qjack_buffer_create(&c->fifo, c->nchannels, c->buffersize * 2); - /* allocate and register the ports */ c->port =3D g_malloc(sizeof(jack_port_t *) * c->nchannels); for (int i =3D 0; i < c->nchannels; ++i) { @@ -468,6 +457,17 @@ static int qjack_client_init(QJackClient *c) jack_activate(c->client); c->buffersize =3D jack_get_buffer_size(c->client); =20 + /* + * ensure the buffersize is no smaller then 512 samples, some (all?) q= emu + * virtual devices do not work correctly otherwise + */ + if (c->buffersize < 512) { + c->buffersize =3D 512; + } + + /* create a 2 period buffer */ + qjack_buffer_create(&c->fifo, c->nchannels, c->buffersize * 2); + qjack_client_connect_ports(c); c->state =3D QJACK_STATE_RUNNING; return 0; --=20 2.20.1 From nobody Sun May 19 10:57:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=reject dis=none) header.from=hostfission.com ARC-Seal: i=1; a=rsa-sha256; t=1592109823; cv=none; d=zohomail.com; s=zohoarc; b=hDFwgiXaj4paxrlJZWXkNLWUx3vi0Dynem5q7kBqPi86QG9PgyOw++0aD0mNszYZqPqZEhlXfjvyweYItcD9cS6s6fhk/hFFr7GwD5mkSkVJrMu3npt4bT0yJgVwxMkoxAOFTffrh2EMrU+rNqOL3zSobcmfka8KRATEMO4Mrzs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592109823; h=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=7r8Y5hBweSUbOg6wNxkWk7YWF2wMsBQnDGD2k6rib78=; b=E04xW5TVcJyI+F1NS6hLW3FU0sCNeR7FzyfPxXH90BNbmfsDpAq0D/dC/Dqz+W78OAj+gs70/csBbtqXHTaaNvCeTl6ROipSTyGfnP+08uTrQMtByGzRxYHnY2rkDklmy1R8L7xsAwxi5lAMHxlnTVLRynS7JnsZkAzzLB4x8a0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592109823165859.1896899065729; Sat, 13 Jun 2020 21:43:43 -0700 (PDT) Received: from localhost ([::1]:41486 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkKUe-0006KN-QL for importer@patchew.org; Sun, 14 Jun 2020 00:43:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jkKTc-0004j2-GE for qemu-devel@nongnu.org; Sun, 14 Jun 2020 00:42:36 -0400 Received: from mail1.hostfission.com ([139.99.139.48]:57376) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkKTa-0005As-Ov for qemu-devel@nongnu.org; Sun, 14 Jun 2020 00:42:36 -0400 Received: from moya.office.hostfission.com (office.hostfission.com [220.233.29.71]) by mail1.hostfission.com (Postfix) with ESMTP id D50C3445DD; Sat, 13 Jun 2020 14:06:01 +1000 (AEST) Received: by moya.office.hostfission.com (Postfix, from userid 0) id BFBF83A0506; Sat, 13 Jun 2020 14:06:01 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hostfission.com; s=mail; t=1592021161; bh=RNNL30Zvo3TCBbXKHnWUPwoWE8O3KEkEzYlBipDJ+Zw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=on3PYVEVAu5AvnuL0SrDm27Nzum/TTWZBatLSVgZg7D4tOFOt84+zS8ORpyrxVHL2 hBksDefPBsbbO0N+tyuB79rFTGPl3AGgg3Wfb4C01JX+fTA2HqA/dcnZpybh/uU3aX w5e5s1TD/9VdYUDtPQdH5eDUbut82Q+tK7Kn/QWU= From: Geoffrey McRae To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, geoff@hostfission.com Subject: [PATCH 2/6] audio/jack: remove unused stopped state Date: Sat, 13 Jun 2020 14:05:14 +1000 Message-Id: <20200613040518.38172-3-geoff@hostfission.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200613040518.38172-1-geoff@hostfission.com> References: <20200613040518.38172-1-geoff@hostfission.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: none client-ip=139.99.139.48; envelope-from=root@moya.office.hostfission.com; helo=mail1.hostfission.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/13 00:05:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @hostfission.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Geoffrey McRae --- audio/jackaudio.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/audio/jackaudio.c b/audio/jackaudio.c index d0b6f748f2..fb8efd7af7 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -38,7 +38,6 @@ struct QJack; =20 typedef enum QJackState { QJACK_STATE_DISCONNECTED, - QJACK_STATE_STOPPED, QJACK_STATE_RUNNING, QJACK_STATE_SHUTDOWN } @@ -549,9 +548,6 @@ static void qjack_client_fini(QJackClient *c) { switch (c->state) { case QJACK_STATE_RUNNING: - /* fallthrough */ - - case QJACK_STATE_STOPPED: for (int i =3D 0; i < c->nchannels; ++i) { jack_port_unregister(c->client, c->port[i]); } --=20 2.20.1 From nobody Sun May 19 10:57:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=reject dis=none) header.from=hostfission.com ARC-Seal: i=1; a=rsa-sha256; t=1592109922; cv=none; d=zohomail.com; s=zohoarc; b=RLv/vZHwaD45EvjE6HCqnNv2UwtdMRu1WsCDkockYBh7T2lmalvUOHnWu3097lpvFbzGkMsr8a30Ia8fcvO65IBbAnwsRrpu0gp5q7Sozyy2H3edJagAtCe2AAwgHntY0dJx1CEp54X4hQkqwNVSfljOrNc9oQUb2KpASVxZwmc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592109922; h=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=OKdLDaW5i9Xuqf8jy7BZKmyXTcIIQuILu2PmH/gPsjE=; b=Wi3lA0/au0lFKLU/ybtlNtuDdNyqqXyPDc88qs+jvGRcwUMgfnBp8cnJVijq02wJHRhUYYN53gw59Inf1KfxcoSwEImCrdV5PhmJWzoLlyLYR1U2Kbdkmfrk/AKb3EhQ81SipLHAMhpyad0jL+qwLLswfHrrNFuStOp1e9oMwwA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592109922575529.163110303476; Sat, 13 Jun 2020 21:45:22 -0700 (PDT) Received: from localhost ([::1]:48204 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkKWH-0000eX-Be for importer@patchew.org; Sun, 14 Jun 2020 00:45:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jkKTf-0004ks-33 for qemu-devel@nongnu.org; Sun, 14 Jun 2020 00:42:39 -0400 Received: from mail1.hostfission.com ([139.99.139.48]:57382) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkKTd-0005Bi-Cw for qemu-devel@nongnu.org; Sun, 14 Jun 2020 00:42:38 -0400 Received: from moya.office.hostfission.com (office.hostfission.com [220.233.29.71]) by mail1.hostfission.com (Postfix) with ESMTP id 80F88445E4; Sat, 13 Jun 2020 14:06:02 +1000 (AEST) Received: by moya.office.hostfission.com (Postfix, from userid 0) id 6A1A33A0958; Sat, 13 Jun 2020 14:06:02 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hostfission.com; s=mail; t=1592021162; bh=YjpDIb+GSt+1KuwILel96z/UXUtCWDBmh9vU9ioxDXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hmvWmZCOqNdqi4z7Bd3w0E5UfMmuaso3kkhFuZKchKSiqALiEy4o0i/foc8OTBb85 KQgKp9ulqXCvrqQl8nQiex2yL8/wECF6Tpakhi5Vaps9j3iedYX2JnNAndn+X8Wi08 3Dj73pfb4/BhxaZMYDYEKOwIizcLQ0wgbHedt8Mw= From: Geoffrey McRae To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, geoff@hostfission.com Subject: [PATCH 3/6] audio/jack: remove invalid set of input support bool Date: Sat, 13 Jun 2020 14:05:15 +1000 Message-Id: <20200613040518.38172-4-geoff@hostfission.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200613040518.38172-1-geoff@hostfission.com> References: <20200613040518.38172-1-geoff@hostfission.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: none client-ip=139.99.139.48; envelope-from=root@moya.office.hostfission.com; helo=mail1.hostfission.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/13 00:05:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @hostfission.com) Content-Type: text/plain; charset="utf-8" Initial code for JACK did not support audio input and as such this boolean was set to let QEMU know, however JACK ended up including input support making this invalid. Further investigation shows it was invalid to set it in the first instance anyway due to a failure on my part understand properly what this was for when the audodev was initially developed. Signed-off-by: Geoffrey McRae --- audio/jackaudio.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/audio/jackaudio.c b/audio/jackaudio.c index fb8efd7af7..58c7344497 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -607,9 +607,6 @@ static int qjack_thread_creator(jack_native_thread_t *t= hread, static void *qjack_init(Audiodev *dev) { assert(dev->driver =3D=3D AUDIODEV_DRIVER_JACK); - - dev->u.jack.has_in =3D false; - return dev; } =20 --=20 2.20.1 From nobody Sun May 19 10:57:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=reject dis=none) header.from=hostfission.com ARC-Seal: i=1; a=rsa-sha256; t=1592109912; cv=none; d=zohomail.com; s=zohoarc; b=RFi4QNXLMRdAL+J9MZAZI1w1+8Gd4+oYCbXwom4MBBxp+ZTvBh62XL5mnLTDu0jsyBL7y0b28IABFXUf3gJWTdqz6aMc1oyIaipQRumRtWdN+KXARWT5NeB9ehs7T4PnFgkWv8c2XrNdQXpk+CAuspAsaiC51ASjkzZnc5MPdNY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592109912; h=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=E4wsXavOBNzstYHlKItDGskUL89vCZkOr0FfQnXXD84=; b=g6hpy1l8WXAVHvcX2CV2qBzVKI/kL5gq1FYKU+DROen7+SKapwVMKlEBCnV5fNRR3P7RM/6ODdp70a+U/y2lh/naY4kkIii8OolXWyC/U+kBxZEiPWESnI7n4a79iajifjjnatOxmRogGldvr5NZq9Ig95yedmBpFsWNCU/42b0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592109912042734.8347470201941; Sat, 13 Jun 2020 21:45:12 -0700 (PDT) Received: from localhost ([::1]:48132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkKW6-0000cn-Qi for importer@patchew.org; Sun, 14 Jun 2020 00:45:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35854) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jkKTd-0004jM-PU for qemu-devel@nongnu.org; Sun, 14 Jun 2020 00:42:37 -0400 Received: from mail1.hostfission.com ([139.99.139.48]:57378) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkKTa-0005Au-OZ for qemu-devel@nongnu.org; Sun, 14 Jun 2020 00:42:37 -0400 Received: from moya.office.hostfission.com (office.hostfission.com [220.233.29.71]) by mail1.hostfission.com (Postfix) with ESMTP id 27335445EF; Sat, 13 Jun 2020 14:06:03 +1000 (AEST) Received: by moya.office.hostfission.com (Postfix, from userid 0) id 123763A0A09; Sat, 13 Jun 2020 14:06:03 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hostfission.com; s=mail; t=1592021163; bh=6tPvqap7tT2aocp2OkZ9oQ/4cf6bTw2xy8Xzm+gjYkU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f4DOmMYExs6g7qBsDLdi/6ucmbXUWi+K8v+TlYbMKcOMkDbPjQUEJdd6Lk6/o2JQu d7b6fXZLwLWJSWPFxGJqNE5y7gLv/V3JD4J64F4Z3QK1b528hBb3izbiIP49oZeeb/ NjNoQJYoavxXJ5Z4QUCeeK0g+1RP95qH4n8nc8TA= From: Geoffrey McRae To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, geoff@hostfission.com Subject: [PATCH 4/6] audio/jack: do not remove ports when finishing Date: Sat, 13 Jun 2020 14:05:16 +1000 Message-Id: <20200613040518.38172-5-geoff@hostfission.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200613040518.38172-1-geoff@hostfission.com> References: <20200613040518.38172-1-geoff@hostfission.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: none client-ip=139.99.139.48; envelope-from=root@moya.office.hostfission.com; helo=mail1.hostfission.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/13 00:05:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @hostfission.com) Content-Type: text/plain; charset="utf-8" This fixes a hang when there is a communications issue with the JACK server. Simply closing the connection is enough to completely clean up and as such we do not need to remove the ports first. As JACK uses a socket based protocol that relies on the `select` call, if there is a communication breakdown with the server the client library waits forever for a response to the unregister request. Signed-off-by: Geoffrey McRae --- audio/jackaudio.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/audio/jackaudio.c b/audio/jackaudio.c index 58c7344497..249cbd3265 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -548,9 +548,6 @@ static void qjack_client_fini(QJackClient *c) { switch (c->state) { case QJACK_STATE_RUNNING: - for (int i =3D 0; i < c->nchannels; ++i) { - jack_port_unregister(c->client, c->port[i]); - } jack_deactivate(c->client); /* fallthrough */ =20 --=20 2.20.1 From nobody Sun May 19 10:57:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=reject dis=none) header.from=hostfission.com ARC-Seal: i=1; a=rsa-sha256; t=1592107999; cv=none; d=zohomail.com; s=zohoarc; b=HusGZ6KU6pfJuCZOVvMBk+xgWmrs1h4wfVLkILUoUfNzeceXgeLOu6doHMufNi7qDDUcjekkagwd3PM//1Bm2tPDWlxcK7HwF7F61ZeZLBPnHC2xO1HV0+4t40PPZPYEmPoRxN7aGogKanVv/cg3ZC62pA8tQaw667XJmbkcAK0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592107999; h=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=syQ7cVBdjSwvfcjXNx6bbkvtoo3Jh+rME40M5u0Mhcg=; b=cFGfgCARWwklz7kADU3j94gcoGkpEYCMk1NLJ9osSv/9Zj17K3NJiKsnc87/RBX9WwmlHMUXLy8HxPgIu4Mk7icFVlyi5SezauTq0uk61DoOB234jVl+1q05FkKovG+bGiCjySooVFLN+RTXFQ5WKsKFuXnCVU/Sq4xtp4/k/ck= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592107999608887.4834432882917; Sat, 13 Jun 2020 21:13:19 -0700 (PDT) Received: from localhost ([::1]:59934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkK1F-0005xx-Df for importer@patchew.org; Sun, 14 Jun 2020 00:13:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jkK0b-0005ZT-TX for qemu-devel@nongnu.org; Sun, 14 Jun 2020 00:12:37 -0400 Received: from mail1.hostfission.com ([139.99.139.48]:57166) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkK0Z-0000Wv-6g for qemu-devel@nongnu.org; Sun, 14 Jun 2020 00:12:37 -0400 Received: from moya.office.hostfission.com (office.hostfission.com [220.233.29.71]) by mail1.hostfission.com (Postfix) with ESMTP id F40CE445F5; Sat, 13 Jun 2020 14:06:03 +1000 (AEST) Received: by moya.office.hostfission.com (Postfix, from userid 0) id DEEF23A0A09; Sat, 13 Jun 2020 14:06:03 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hostfission.com; s=mail; t=1592021164; bh=OdRJm45Q4UNv6+P+Ib6qm82RVr++vAH8VUG3t1Sh9As=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EQ6RRkbTradms1c0z8CjTkJwEhZCGlifW+0zK7nIftNw4xvLHlCAfgzq1RoPUTVXA +AAEe3GSWdDPDt0h3FwlCRAoXG5Jt9dxHGER6X9MCCVn7I5JvCtWo7dcIb0xImPQKU HxNYSfgxKO6bsuFxtME/KslpjAOgduxzOMlJb5P0= From: Geoffrey McRae To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, geoff@hostfission.com Subject: [PATCH 5/6] audio/jack: honour the enable state of the audio device Date: Sat, 13 Jun 2020 14:05:17 +1000 Message-Id: <20200613040518.38172-6-geoff@hostfission.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200613040518.38172-1-geoff@hostfission.com> References: <20200613040518.38172-1-geoff@hostfission.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: none client-ip=139.99.139.48; envelope-from=root@moya.office.hostfission.com; helo=mail1.hostfission.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/13 00:05:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @hostfission.com) Content-Type: text/plain; charset="utf-8" When the guest closes the audio device we must start dropping input samples from JACK and zeroing the output buffer samples. Failure to do so causes sound artifacts during operations such as guest OS reboot, and causes a hang of the input pipeline breaking it until QEMU is restated. Closing and reconnecting to JACK was tested during these enable/disable calls which works well for Linux guests, however Windows re-opens the audio hardware repeatedly even when doing simple tasks like playing a system sounds. As such it was decided it is better to feed silence to JACK while the device is disabled. Signed-off-by: Geoffrey McRae --- audio/jackaudio.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/audio/jackaudio.c b/audio/jackaudio.c index 249cbd3265..b2b53985ae 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -56,7 +56,7 @@ typedef struct QJackClient { AudiodevJackPerDirectionOptions *opt; =20 bool out; - bool finished; + bool enabled; bool connect_ports; int packets; =20 @@ -271,9 +271,17 @@ static int qjack_process(jack_nframes_t nframes, void = *arg) } =20 if (c->out) { - qjack_buffer_read_l(&c->fifo, buffers, nframes); + if (likely(c->enabled)) { + qjack_buffer_read_l(&c->fifo, buffers, nframes); + } else { + for(int i =3D 0; i < c->nchannels; ++i) { + memset(buffers[i], 0, nframes * sizeof(float)); + } + } } else { - qjack_buffer_write_l(&c->fifo, buffers, nframes); + if (likely(c->enabled)) { + qjack_buffer_write_l(&c->fifo, buffers, nframes); + } } =20 return 0; @@ -314,8 +322,8 @@ static void qjack_client_recover(QJackClient *c) if (c->state =3D=3D QJACK_STATE_DISCONNECTED && c->packets % 100 =3D=3D 0) { =20 - /* if not finished then attempt to recover */ - if (!c->finished) { + /* if enabled then attempt to recover */ + if (c->enabled) { dolog("attempting to reconnect to server\n"); qjack_client_init(c); } @@ -387,7 +395,6 @@ static int qjack_client_init(QJackClient *c) char client_name[jack_client_name_size()]; jack_options_t options =3D JackNullOption; =20 - c->finished =3D false; c->connect_ports =3D true; =20 snprintf(client_name, sizeof(client_name), "%s-%s", @@ -483,8 +490,10 @@ static int qjack_init_out(HWVoiceOut *hw, struct audse= ttings *as, } =20 jo->c.out =3D true; + jo->c.enabled =3D false; jo->c.nchannels =3D as->nchannels; jo->c.opt =3D dev->u.jack.out; + int ret =3D qjack_client_init(&jo->c); if (ret !=3D 0) { return ret; @@ -519,8 +528,10 @@ static int qjack_init_in(HWVoiceIn *hw, struct audsett= ings *as, } =20 ji->c.out =3D false; + ji->c.enabled =3D false; ji->c.nchannels =3D as->nchannels; ji->c.opt =3D dev->u.jack.in; + int ret =3D qjack_client_init(&ji->c); if (ret !=3D 0) { return ret; @@ -568,23 +579,25 @@ static void qjack_client_fini(QJackClient *c) static void qjack_fini_out(HWVoiceOut *hw) { QJackOut *jo =3D (QJackOut *)hw; - jo->c.finished =3D true; qjack_client_fini(&jo->c); } =20 static void qjack_fini_in(HWVoiceIn *hw) { QJackIn *ji =3D (QJackIn *)hw; - ji->c.finished =3D true; qjack_client_fini(&ji->c); } =20 static void qjack_enable_out(HWVoiceOut *hw, bool enable) { + QJackOut *jo =3D (QJackOut *)hw; + jo->c.enabled =3D enable; } =20 static void qjack_enable_in(HWVoiceIn *hw, bool enable) { + QJackIn *ji =3D (QJackIn *)hw; + ji->c.enabled =3D enable; } =20 static int qjack_thread_creator(jack_native_thread_t *thread, --=20 2.20.1 From nobody Sun May 19 10:57:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=reject dis=none) header.from=hostfission.com ARC-Seal: i=1; a=rsa-sha256; t=1592109823; cv=none; d=zohomail.com; s=zohoarc; b=MZqTGdiP6vTknOZ9yTvOljDJqNQmt5QpfRxhQeO0F79cpiZBFzDz4adIitAlBBoBwP49WoWz+egos7q7zYkbajzEqWFsjCgd0qOYAL7RCri7mBJ+uJgbe6DfZQNEhBWmSz7aps7g6qONN7UTpZM5uhTr/P24oA/ZhJRS85lgHA8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592109823; h=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=8lzSMWkz4/26BvfGQ4TY/OmUzqMx02SXXIUflE5X6FY=; b=BSHN7KZwcRxbWFAUBst2OBZ6bH35mOE9ye9LpcBzAbcc419Bp0exk1vBeUci+tAe5FNyGdBlYkGK11HMA4GML1OZTxpkN4jqHHFLsNtpMmOWpAEngl1jnYRcm4hjj3FPzCU9pSQblZc/FDCT4jJIXkFSUEE7M1Kc9P2vu7DAXCo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592109823741944.024278103725; Sat, 13 Jun 2020 21:43:43 -0700 (PDT) Received: from localhost ([::1]:41618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkKUg-0006NV-2H for importer@patchew.org; Sun, 14 Jun 2020 00:43:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35848) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jkKTd-0004jI-LP for qemu-devel@nongnu.org; Sun, 14 Jun 2020 00:42:37 -0400 Received: from mail1.hostfission.com ([139.99.139.48]:57372) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkKTa-0005At-Ov for qemu-devel@nongnu.org; Sun, 14 Jun 2020 00:42:37 -0400 Received: from moya.office.hostfission.com (office.hostfission.com [220.233.29.71]) by mail1.hostfission.com (Postfix) with ESMTP id DF8ED445F6; Sat, 13 Jun 2020 14:06:04 +1000 (AEST) Received: by moya.office.hostfission.com (Postfix, from userid 0) id C04453A0A92; Sat, 13 Jun 2020 14:06:04 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hostfission.com; s=mail; t=1592021164; bh=QxgI9gPW5oZsvfCtNVXMOw4HIOXfaMXfBHFgy7Qiw1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ttbpSoyw36xcSp/O8HxzCHK0KaV40vPbT9FFMZPYb89dwCurXYjD+fiMkkpzpYJpq p/ZUw/z7fZOdM48cwsC4JHOGCD62OTUgBMGMeuyvqcK4Ftp4KzLqjiXY08jZ1wq+U+ dPOkG2nPXZF74vLZRlHiNFmRMEDkTzuWh14IG5Hc= From: Geoffrey McRae To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, geoff@hostfission.com Subject: [PATCH 6/6] audio/jack: simplify the re-init code path Date: Sat, 13 Jun 2020 14:05:18 +1000 Message-Id: <20200613040518.38172-7-geoff@hostfission.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200613040518.38172-1-geoff@hostfission.com> References: <20200613040518.38172-1-geoff@hostfission.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: none client-ip=139.99.139.48; envelope-from=root@moya.office.hostfission.com; helo=mail1.hostfission.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/13 00:05:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @hostfission.com) Content-Type: text/plain; charset="utf-8" Instead of checking for the audodev state in each code path, centralize the check into the initialize function itself to make it safe to call it at any time. Signed-off-by: Geoffrey McRae --- audio/jackaudio.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/audio/jackaudio.c b/audio/jackaudio.c index b2b53985ae..72ed7c4929 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -395,6 +395,10 @@ static int qjack_client_init(QJackClient *c) char client_name[jack_client_name_size()]; jack_options_t options =3D JackNullOption; =20 + if (c->state =3D=3D QJACK_STATE_RUNNING) { + return 0; + } + c->connect_ports =3D true; =20 snprintf(client_name, sizeof(client_name), "%s-%s", @@ -485,9 +489,7 @@ static int qjack_init_out(HWVoiceOut *hw, struct audset= tings *as, QJackOut *jo =3D (QJackOut *)hw; Audiodev *dev =3D (Audiodev *)drv_opaque; =20 - if (jo->c.state !=3D QJACK_STATE_DISCONNECTED) { - return 0; - } + qjack_client_fini(&jo->c); =20 jo->c.out =3D true; jo->c.enabled =3D false; @@ -523,9 +525,7 @@ static int qjack_init_in(HWVoiceIn *hw, struct audsetti= ngs *as, QJackIn *ji =3D (QJackIn *)hw; Audiodev *dev =3D (Audiodev *)drv_opaque; =20 - if (ji->c.state !=3D QJACK_STATE_DISCONNECTED) { - return 0; - } + qjack_client_fini(&ji->c); =20 ji->c.out =3D false; ji->c.enabled =3D false; --=20 2.20.1