qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] pulseaudio: reduce 24s recording latency


From: Volker Rümelin
Subject: [Qemu-devel] [PATCH] pulseaudio: reduce 24s recording latency
Date: Fri, 11 Sep 2015 21:03:57 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

Current code doesn't provide pulseaudio buffer attributes for
recording. Without buffer attributes pulseaudio uses a default
buffer of 4MB. 4MB is approximately 24s 16bit stereo audio
data at 44.1kHz.

This patch fixes bug #1492649

|Signed-off-by: Volker Rümelin <address@hidden>|
---
 audio/paaudio.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/audio/paaudio.c b/audio/paaudio.c
index fea6071..c1169d4 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -608,6 +608,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;
@@ -616,6 +617,12 @@ static int qpa_init_in(HWVoiceIn *hw, struct audsettings 
*as, void *drv_opaque)
     ss.channels = as->nchannels;
     ss.rate = as->freq;
 
+    ba.fragsize = pa_frame_size (&ss) * g->conf.samples;
+    ba.maxlength = 5 * ba.fragsize;
+    ba.tlength = -1;
+    ba.prebuf = -1;
+    ba.minreq = -1;
+
     obt_as.fmt = pa_to_audfmt (ss.format, &obt_as.endianness);
 
     pa->stream = qpa_simple_new (
@@ -625,7 +632,7 @@ static int qpa_init_in(HWVoiceIn *hw, struct audsettings 
*as, void *drv_opaque)
         g->conf.source,
         &ss,
         NULL,                   /* channel map */
-        NULL,                   /* buffering attributes */
+        &ba,                    /* buffering attributes */
         &error
         );
     if (!pa->stream) {
-- 
1.8.4.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]