summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-04-15 12:34:06 +0100
committercah <cah@ableton.com>2019-12-03 11:16:07 +0100
commit0668f1fc1b65ffbe752e194663b833e27a29e7c6 (patch)
tree6faa7dd13196cfe35b0ddac1c741cf234f9b7237
parentdbb4f997a37d4056ce1ed04ede07afb449beb13d (diff)
Report playback latency for PulseAudio.
-rw-r--r--RtAudio.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/RtAudio.cpp b/RtAudio.cpp
index 1b27de1..264d5f6 100644
--- a/RtAudio.cpp
+++ b/RtAudio.cpp
@@ -8640,6 +8640,14 @@ void RtApiPulse::callbackEvent( void )
MUTEX_UNLOCK( &stream_.mutex );
RtApi::tickStreamTime();
+ if (pah->s_play) {
+ int e = 0;
+ pa_usec_t const lat = pa_simple_get_latency(pah->s_play, &e);
+ if (e == 0) {
+ stream_.latency[0] = lat * stream_.sampleRate / 1000000;
+ }
+ }
+
if ( doStopStream == 1 )
stopStream();
}