All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Volker Rümelin" <vr_qemu@t-online.de>
To: qemu-devel@nongnu.org
Cc: "Gerd Hoffmann" <kraxel@redhat.com>,
	"Kővágó, Zoltán" <dirty.ice.hu@gmail.com>
Subject: [Qemu-devel] [PATCH] pulseaudio: reduce 24s recording latency
Date: Fri, 11 Sep 2015 21:03:57 +0200	[thread overview]
Message-ID: <55F3259D.3000309@t-online.de> (raw)

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

             reply	other threads:[~2015-09-11 19:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11 19:03 Volker Rümelin [this message]
2015-09-11 23:22 ` [Qemu-devel] [PATCH] pulseaudio: reduce 24s recording latency 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55F3259D.3000309@t-online.de \
    --to=vr_qemu@t-online.de \
    --cc=dirty.ice.hu@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.