From 8cf10ffda783f3e415927097f3942729ffd8fc57 Mon Sep 17 00:00:00 2001 From: Thomas Guillem Date: Fri, 18 Nov 2022 15:01:41 +0100 Subject: [PATCH] audiounit: add IOBufferDuration + kAudioUnitProperty_Latency Still not happy with the A/V sync when using external devices, even with this commit. --- modules/audio_output/audiounit_ios.m | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/audio_output/audiounit_ios.m b/modules/audio_output/audiounit_ios.m index c66ff9a6c61b..cdaa039d1eb3 100644 --- a/modules/audio_output/audiounit_ios.m +++ b/modules/audio_output/audiounit_ios.m @@ -159,10 +159,19 @@ - (NSInteger)removeAoutInstance:(AoutWrapper *)wrapperInstance { aout_sys_t *p_sys = p_aout->sys; - vlc_tick_t latency_us = - vlc_tick_from_sec([p_sys->avInstance outputLatency]); + Float64 unit_s; + vlc_tick_t latency_us = 0, us; - msg_Dbg(p_aout, "Current device has a latency of %lld us", latency_us); + us = vlc_tick_from_sec([p_sys->avInstance outputLatency]); + msg_Dbg(p_aout, "Current device has a outputLatency of %" PRId64 "us", us); + latency_us += us; + + us = vlc_tick_from_sec([p_sys->avInstance IOBufferDuration]); + msg_Dbg(p_aout, "Current device has a IOBufferDuration of %" PRId64 "us", us); + latency_us += us; + + msg_Dbg(p_aout, "Current device has a total latency of %" PRId64 "us", + latency_us); return latency_us; }