Skip to content

Commit

Permalink
coreaudio: use clock_gettime_nsec_np()
Browse files Browse the repository at this point in the history
Instead of mach_absolute_time().

As recommended by the documentation.
  • Loading branch information
tguillem committed Jan 2, 2023
1 parent 81c7e3c commit 7eaa685
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions modules/audio_output/coreaudio_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 7eaa685

Please sign in to comment.