From 7eaa685ea47941ce269ea0182b082a18d9864338 Mon Sep 17 00:00:00 2001 From: Thomas Guillem Date: Wed, 14 Dec 2022 15:06:07 +0100 Subject: [PATCH] coreaudio: use clock_gettime_nsec_np() Instead of mach_absolute_time(). As recommended by the documentation. --- modules/audio_output/coreaudio_common.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/audio_output/coreaudio_common.c b/modules/audio_output/coreaudio_common.c index 1ee1a228eb46..a7e6a5d13497 100644 --- a/modules/audio_output/coreaudio_common.c +++ b/modules/audio_output/coreaudio_common.c @@ -156,8 +156,13 @@ ca_Render(audio_output_t *p_aout, uint64_t host_time, { struct aout_sys_common *p_sys = (struct aout_sys_common *) p_aout->sys; - const vlc_tick_t host_delay_ticks = host_time == 0 ? 0 - : HostTimeToTick(p_sys, host_time - mach_absolute_time()); + vlc_tick_t host_delay_ticks = 0; + if (host_time != 0) + { + uint64_t now_nsec = clock_gettime_nsec_np(CLOCK_UPTIME_RAW); + host_delay_ticks = HostTimeToTick(p_sys, host_time) + - VLC_TICK_FROM_NS(now_nsec); + } const vlc_tick_t bytes_ticks = BytesToTicks(p_sys, bytes); const vlc_tick_t now_ticks = vlc_tick_now();