[pulseaudio-discuss] how to get accurate stream latency information during underrun

Ludovic Gu├ęgan ludovic.guegan at gmail.com
Fri Sep 29 09:46:10 UTC 2017

Hi everyone,

First, i am new to PulseAudio and the mailing list, so let me say it: Thank
you all !

In the context of my application, it is important to accurately estimate
the audio latency in order to synchronize the speaker output with some
motor movements.

I used to query the audio latency using pa_stream_get_latency(), but the
returned information does not seems to correspond to observed latency in
the following situation:

When my application stops sending data (after the underflow event), the
value returned by pa_stream_get_latency() stays constant and does not

When writing again data into the stream (long after the underflow event and
without any cork/uncork operation), the sound is outputted to the speaker
without the latency delay advertised by pa_stream_get_latency().

Since this is the first time i use the PulseAudio API, i might not
understand correctly the purpose of pa_stream_get_latency() and I wonder
what is the correct way to obtain the most accurate estimation of the
latency ?

Thank you very much,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20170929/a17132a2/attachment.html>

More information about the pulseaudio-discuss mailing list