aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorMartin Schrodt <martin@schrodt.org>2019-03-15 09:46:53 +0100
committerGerd Hoffmann <kraxel@redhat.com>2019-03-18 12:21:15 +0100
commitade103011c6476353fbc2a707aa6ef1f1aa9e2fb (patch)
tree7fa1dade5bab2331b2a523952cb5c4f63965e97e /audio
parentf6142777659f2e7ad143f2850f1f036f899f475f (diff)
downloadqemu-ade103011c6476353fbc2a707aa6ef1f1aa9e2fb.zip
qemu-ade103011c6476353fbc2a707aa6ef1f1aa9e2fb.tar.gz
qemu-ade103011c6476353fbc2a707aa6ef1f1aa9e2fb.tar.bz2
audio/paaudio: fix microphone input being unusable
The current code does not specify the metrics of the buffers for the input device. This makes PulseAudio choose very bad defaults, which causes input to be unusable: Audio put in gets out 30 seconds later. This patch fixes that and makes the latency configurable as well. Signed-off-by: Martin Schrodt <martin@schrodt.org> Message-id: 20190315084653.120020-4-martin@schrodt.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'audio')
-rw-r--r--audio/paaudio.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/audio/paaudio.c b/audio/paaudio.c
index be27c73..45295b4 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -605,6 +605,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;
@@ -615,6 +616,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 (
@@ -624,7 +630,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) {