[vlc-commits] coreaudio: add the HostTimeToTick() helper
Thomas Guillem
git at videolan.org
Wed Aug 21 09:57:50 CEST 2019
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Aug 16 10:00:46 2019 +0200| [3249915c5794647ee3b2c62dcc0a973654ccdb74] | committer: Thomas Guillem
coreaudio: add the HostTimeToTick() helper
And use the VLC_TICK_FROM_NS() helper.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3249915c5794647ee3b2c62dcc0a973654ccdb74
---
modules/audio_output/coreaudio_common.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/modules/audio_output/coreaudio_common.c b/modules/audio_output/coreaudio_common.c
index 0b55e86d56..c20a07670c 100644
--- a/modules/audio_output/coreaudio_common.c
+++ b/modules/audio_output/coreaudio_common.c
@@ -42,6 +42,13 @@ FramesToUs(struct aout_sys_common *p_sys, uint64_t i_nb_frames)
return vlc_tick_from_samples(i_nb_frames, p_sys->i_rate);
}
+static inline vlc_tick_t
+HostTimeToTick(uint64_t i_host_time)
+{
+ assert(tinfo.denom != 0);
+ return VLC_TICK_FROM_NS(i_host_time * tinfo.numer / tinfo.denom);
+}
+
static void
ca_ClearOutBuffers(audio_output_t *p_aout)
{
@@ -199,8 +206,7 @@ ca_TimeGet(audio_output_t *p_aout, vlc_tick_t *delay)
return -1;
}
- const uint64_t i_render_time_us = p_sys->i_render_host_time
- * tinfo.numer / tinfo.denom / 1000;
+ const vlc_tick_t i_render_time_us = HostTimeToTick(p_sys->i_render_host_time);
const vlc_tick_t i_render_delay = i_render_time_us - vlc_tick_now();
const int64_t i_out_frames = BytesToFrames(p_sys, p_sys->i_out_size);
More information about the vlc-commits
mailing list