From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46325) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaquC-0006Cq-BH for qemu-devel@nongnu.org; Sat, 12 Sep 2015 15:56:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zaqu9-0000Po-4q for qemu-devel@nongnu.org; Sat, 12 Sep 2015 15:56:12 -0400 Received: from mailout07.t-online.de ([194.25.134.83]:54611) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zaqu8-0000PY-VB for qemu-devel@nongnu.org; Sat, 12 Sep 2015 15:56:09 -0400 References: <55F3259D.3000309@t-online.de> <55F40B4C.5000101@t-online.de> <55F4384C.1050707@gmail.com> From: =?UTF-8?Q?Volker_R=c3=bcmelin?= Message-ID: <55F48340.6020901@t-online.de> Date: Sat, 12 Sep 2015 21:55:44 +0200 MIME-Version: 1.0 In-Reply-To: <55F4384C.1050707@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] pulseaudio: reduce 24s recording latency List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?S8WRdsOhZ8OzIFpvbHTDoW4=?= Cc: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , QEMU , Gerd Hoffmann Am 12.09.2015 um 16:35 schrieb K=C5=91v=C3=A1g=C3=B3 Zolt=C3=A1n: > 2015-09-12 13:23 keltez=C3=A9ssel, Volker R=C3=BCmelin =C3=ADrta: >> >> 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 th= at >> data if there is no process listening on the audio interface. Now if t= he >> guest starts recording, it will see audio data which was recorded 24s=20 >> ago. > > Weird, pulseaudio shouldn't delay the input more than 2 seconds in the=20 > default config. Maybe PA_STREAM_EARLY_REQUESTS help. See my patch at=20 > [1]. Alternatively we should maybe call pa_stream_flush when enabling=20 > the input to tell pulseaudio to drop previously recorded samples. > > [1]: https://lists.gnu.org/archive/html/qemu-devel/2015-08/msg02455.htm= l > Hi Zoltan, I tested your suggestions. There was the same 24s latency when I replaced PA_STREAM_ADJUST_LATENCY=20 with PA_STREAM_EARLY_REQUESTS in function pa_stream_connect_record. This=20 was to be expected, because the pulseaudio documentation only mentions=20 playback there. A call to pa_stream_flush in qpa_ctl_in in case VOICE_ENABLE: also=20 didn't solve the problem. But when I replaced pa_stream_flush with a repeated call to=20 pa_stream_peek and pa_stream_drop things started to improve. Now I=20 experience the 1-2s recording latency mentioned in the pulseaudio=20 documentation. But this is still much higher than the latency I see with=20 my old patch. Regards, Volker