Am 12.09.2015 um 16:35 schrieb Kővágó Zoltán:
2015-09-12 13:23 keltezéssel, Volker Rümelin írta:
On start up qemu opens a connection to pulseaudio in function
qpa_init_in and pulseaudio immediately starts recording to the 4MB
ringbuffer. The qemu guest, Windows 8.1 in my case, doesn't consume that
data if there is no process listening on the audio interface. Now if the
guest starts recording, it will see audio data which was recorded 24s
ago.
Weird, pulseaudio shouldn't delay the input more than 2 seconds in the
default config. Maybe PA_STREAM_EARLY_REQUESTS help. See my patch at
[1]. Alternatively we should maybe call pa_stream_flush when enabling
the input to tell pulseaudio to drop previously recorded samples.
[1]: https://lists.gnu.org/archive/html/qemu-devel/2015-08/msg02455.html
Hi Zoltan,
I tested your suggestions.
There was the same 24s latency when I replaced PA_STREAM_ADJUST_LATENCY
with PA_STREAM_EARLY_REQUESTS in function pa_stream_connect_record. This
was to be expected, because the pulseaudio documentation only mentions
playback there.
A call to pa_stream_flush in qpa_ctl_in in case VOICE_ENABLE: also
didn't solve the problem.
But when I replaced pa_stream_flush with a repeated call to
pa_stream_peek and pa_stream_drop things started to improve. Now I
experience the 1-2s recording latency mentioned in the pulseaudio
documentation. But this is still much higher than the latency I see with
my old patch.
Regards,
Volker