From 7c032bde3e6473902bbda2aea65be4bfb9d68802 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 6 Jul 2015 17:49:28 +0200 Subject: ao_coreaudio: fix device latency, share the code ao_coreaudio (using AudioUnit) accounted only for part of the latency - move the code in ao_coreaudio_exclusive to utils, and use that for the AudioUnit code. (There's still the question why CoreAudio and AudioUnit require you to jump through hoops this much, but apparently that's how it is.) --- audio/out/ao_coreaudio.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'audio/out/ao_coreaudio.c') diff --git a/audio/out/ao_coreaudio.c b/audio/out/ao_coreaudio.c index 1cf38326a2..c592c0ef84 100644 --- a/audio/out/ao_coreaudio.c +++ b/audio/out/ao_coreaudio.c @@ -56,12 +56,8 @@ static int64_t ca_get_hardware_latency(struct ao *ao) { &size); CHECK_CA_ERROR("cannot get audio unit latency"); - uint32_t frames = 0; - err = CA_GET_O(p->device, kAudioDevicePropertyLatency, &frames); - CHECK_CA_ERROR("cannot get device latency"); - uint64_t audiounit_latency_us = audiounit_latency_sec * 1e6; - uint64_t device_latency_us = ca_frames_to_us(ao, frames); + uint64_t device_latency_us = ca_get_device_latency_us(ao, p->device); MP_VERBOSE(ao, "audiounit latency [us]: %lld\n", audiounit_latency_us); MP_VERBOSE(ao, "device latency [us]: %lld\n", device_latency_us); -- cgit v1.2.3