diff options
author | Dudemanguy <random342@airmail.cc> | 2023-10-11 13:45:40 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-10-16 15:38:59 +0000 |
commit | 50025428b17e82c9689dab82fcd0486648c4a9fd (patch) | |
tree | f9039f4110dd54be060b5e7ef4ef3131be0a3e32 /audio/out/ao_audiounit.m | |
parent | d310430332b9c7dbedf28398b7018364401d327d (diff) | |
download | mpv-50025428b17e82c9689dab82fcd0486648c4a9fd.tar.bz2 mpv-50025428b17e82c9689dab82fcd0486648c4a9fd.tar.xz |
ao: convert all timing code to nanoseconds
Pull AOs work off of a callback that relies on mpv's internal timer. So
like with the related video changes, convert all of these to nanoseconds
instead. In many cases, the underlying audio API does actually provide
nanosecond resolution as well.
Diffstat (limited to 'audio/out/ao_audiounit.m')
-rw-r--r-- | audio/out/ao_audiounit.m | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/audio/out/ao_audiounit.m b/audio/out/ao_audiounit.m index 91f0dd168a..85b1226dc9 100644 --- a/audio/out/ao_audiounit.m +++ b/audio/out/ao_audiounit.m @@ -94,9 +94,9 @@ static OSStatus render_cb_lpcm(void *ctx, AudioUnitRenderActionFlags *aflags, for (int n = 0; n < ao->num_planes; n++) planes[n] = buffer_list->mBuffers[n].mData; - int64_t end = mp_time_us(); - end += p->device_latency * 1e6; - end += ca_get_latency(ts) + ca_frames_to_us(ao, frames); + int64_t end = mp_time_ns(); + end += MP_TIME_S_TO_NS(p->device_latency); + end += ca_get_latency(ts) + ca_frames_to_ns(ao, frames); ao_read_data(ao, planes, frames, end); return noErr; } |