From nobody Tue May 7 15:46:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1560613223; cv=none; d=zoho.com; s=zohoarc; b=HkfI1PEant6o1Xgp6S0Ihml7xe/CcLPCTON/OMer/+N7UeuXgayj77eGhH2ffWQGA/4eAZCynwfJdtpMl4MBCz1eOMlVfKhn45b9/dV71Wf7F3WYEcRGlboZRinbmTORkKhiolcx6EOCFJ9oVVE9QbIyNXz3Kv9WuneMfeqmrjA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560613223; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=7nFMd4T5C6eeOQyK4IZNrskaSBemqy13jG6T15Ej5lw=; b=WvuUereGER9pmh6WXy6EuiuLg6TcIkeSYRIiNDF5FZVjR5Vrmm5A03myZuLHS+xsyc5iXFrfSSWg86jjyUiSf2rGmbznbloIZj97SLTwxd5ka57vVRX58t0VrbFip+cIalfHFxNfOaUPX2twRwOjX/gaaCknp2j7RhMLdZf3lvo= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560613223707345.66473674915994; Sat, 15 Jun 2019 08:40:23 -0700 (PDT) Received: from localhost ([::1]:32835 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcAmv-00011T-7b for importer@patchew.org; Sat, 15 Jun 2019 11:40:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34544) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcAlm-0008VU-Fi for qemu-devel@nongnu.org; Sat, 15 Jun 2019 11:39:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hcAll-0006r6-IL for qemu-devel@nongnu.org; Sat, 15 Jun 2019 11:39:06 -0400 Received: from zapp.schrodt.org ([46.4.119.246]:39286) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hcAll-0006S1-CA for qemu-devel@nongnu.org; Sat, 15 Jun 2019 11:39:05 -0400 Received: from schapa.schrodt.org ([109.192.32.242]:59940 helo=zoidberg.machine.schrodt.org) by zapp.schrodt.org with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1hcAla-0004Hk-RL; Sat, 15 Jun 2019 17:38:54 +0200 Received: from spheenik by zoidberg.machine.schrodt.org with local (Exim 4.92) (envelope-from ) id 1hcAlY-000Pms-MZ; Sat, 15 Jun 2019 17:38:52 +0200 From: Martin Schrodt To: qemu-devel@nongnu.org Date: Sat, 15 Jun 2019 17:38:52 +0200 Message-Id: <20190615153852.99040-1-martin@schrodt.org> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 46.4.119.246 Subject: [Qemu-devel] [PATCH] fix microphone lag with PA 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: kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Several people have reported to have bag microphone lag with the PA backend. While I cannot reproduce the problem here, it seems that their PA somehow decides to buffer the microphone input for way too long, causing this delay. This patch sets an upper limit to the amount of data PA should hold. This fixes the problem reliably on their side, while having no adverse effects on mine. Signed-off-by: Martin Schrodt --- audio/paaudio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/paaudio.c b/audio/paaudio.c index fa9dd9efd4..5fc886bb33 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -618,7 +618,7 @@ static int qpa_init_in(HWVoiceIn *hw, struct audsetting= s *as, void *drv_opaque) ss.rate =3D as->freq; =20 ba.fragsize =3D pa_usec_to_bytes(ppdo->latency, &ss); - ba.maxlength =3D -1; + ba.maxlength =3D pa_usec_to_bytes(ppdo->latency * 2, &ss); ba.minreq =3D -1; ba.prebuf =3D -1; =20 --=20 2.22.0