]> git.proxmox.com Git - mirror_qemu.git/commitdiff
fix microphone lag with PA
authorMartin Schrodt <martin@schrodt.org>
Sat, 15 Jun 2019 15:38:52 +0000 (17:38 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 3 Jul 2019 06:50:56 +0000 (08:50 +0200)
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 <martin@schrodt.org>
Message-id: 20190615153852.99040-1-martin@schrodt.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
audio/paaudio.c

index fa9dd9efd4cc467330d491bd6c992e25c1bf2d49..5fc886bb33cda2ddc3517b344e672738970bead5 100644 (file)
@@ -618,7 +618,7 @@ static int qpa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
     ss.rate = as->freq;
 
     ba.fragsize = pa_usec_to_bytes(ppdo->latency, &ss);
-    ba.maxlength = -1;
+    ba.maxlength = pa_usec_to_bytes(ppdo->latency * 2, &ss);
     ba.minreq = -1;
     ba.prebuf = -1;