All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pulseaudio: reduce 24s recording latency
@ 2015-09-11 19:03 Volker Rümelin
  2015-09-11 23:22 ` Marc-André Lureau
  2015-09-12 12:07 ` Marc-André Lureau
  0 siblings, 2 replies; 6+ messages in thread
From: Volker Rümelin @ 2015-09-11 19:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Kővágó, Zoltán

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 <vr_qemu@t-online.de>|
---
 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-09-12 19:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-11 19:03 [Qemu-devel] [PATCH] pulseaudio: reduce 24s recording latency Volker Rümelin
2015-09-11 23:22 ` Marc-André Lureau
2015-09-12 11:23   ` Volker Rümelin
2015-09-12 14:35     ` Kővágó Zoltán
2015-09-12 19:55       ` Volker Rümelin
2015-09-12 12:07 ` Marc-André Lureau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.