diff mbox series

[3/3] fix input lag

Message ID 20190314133858.37970-4-martin@schrodt.org (mailing list archive)
State New, archived
Headers show
Series Fixes for PulseAudio driver | expand

Commit Message

Martin Schrodt March 14, 2019, 1:38 p.m. UTC
Signed-off-by: Martin Schrodt <martin@schrodt.org>
---
 audio/paaudio.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Eric Blake March 14, 2019, 2:05 p.m. UTC | #1
On 3/14/19 8:38 AM, Martin Schrodt wrote:
> Signed-off-by: Martin Schrodt <martin@schrodt.org>

Again, the commit message body needs to give details, such as your cover
letter mentioning that without this patch that the default was a 30
second lag.  Especially since reading this patch alone does not provide
any clue as to what the lag was without this patch, where knowing that
bit of information becomes a powerful reason to apply the patch.
diff mbox series

Patch

diff --git a/audio/paaudio.c b/audio/paaudio.c
index c9007fdb01..e4370c3113 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -600,6 +600,7 @@  static int qpa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
 {
     int error;
     pa_sample_spec ss;
+    pa_buffer_attr ba;
     struct audsettings obt_as = *as;
     PAVoiceIn *pa = (PAVoiceIn *) hw;
     paaudio *g = pa->g = drv_opaque;
@@ -610,6 +611,11 @@  static int qpa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
     ss.channels = as->nchannels;
     ss.rate = as->freq;
 
+    ba.fragsize = pa_usec_to_bytes (ppdo->latency, &ss);
+    ba.maxlength = -1;
+    ba.minreq = -1;
+    ba.prebuf = -1;
+
     obt_as.fmt = pa_to_audfmt (ss.format, &obt_as.endianness);
 
     pa->stream = qpa_simple_new (
@@ -619,7 +625,7 @@  static int qpa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
         ppdo->has_name ? ppdo->name : NULL,
         &ss,
         NULL,                   /* channel map */
-        NULL,                   /* buffering attributes */
+        &ba,                    /* buffering attributes */
         &error
         );
     if (!pa->stream) {