AppleHostClock

The one clock the engine and the audio device share on Apple platforms.

This matters more than it looks. CoreAudio reports when a buffer will be heard as a host time, and the engine anchors its audio clock to that instant. If the engine measured time from a different source, the two would agree only by luck, and audio and video would sit at a constant offset that no correction could ever find, because both sides would believe they were right.

So the sink and the engine are handed the same clock explicitly, through AppleOutputBackend in PlayerConfig.backends.output, rather than each picking its own. That object pairs this clock with the sink factory that reports on it, which is what makes the mismatch unassemblable rather than merely checked. CoreVideo exposes that shared host clock without allocating on each reading.

Functions

Link copied to clipboard
fun hostTimeToNanos(hostTime: ULong): Long

Converts a CoreAudio timestamp's host time into the same nanoseconds nanos returns.

Link copied to clipboard
open override fun nanos(): Long