aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2015-04-28 22:09:51 +0200
committerGravatar wm4 <wm4@nowhere>2015-04-28 22:09:51 +0200
commit5f86fad2f0ab76b7497230b18cd146a7c4d38cd2 (patch)
tree90b6b0083970cd451dbd277cec85a5f703eea697
parent025cb3b9e384883c90255173bc4f2fcb4dd74106 (diff)
ao_coreaudio_exclusive: account for additional latency
Whether this is correct is unknown. This change tripples the latency from ~15ms to ~45ms. XBMC does this, VLC does not from what I could see.
-rw-r--r--audio/out/ao_coreaudio_exclusive.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/audio/out/ao_coreaudio_exclusive.c b/audio/out/ao_coreaudio_exclusive.c
index cc8c33e72e..762decffa4 100644
--- a/audio/out/ao_coreaudio_exclusive.c
+++ b/audio/out/ao_coreaudio_exclusive.c
@@ -501,10 +501,17 @@ static int init_digital(struct ao *ao, AudioStreamBasicDescription asbd)
p->stream_asbd.mFramesPerPacket);
uint32_t latency_frames = 0;
- err = CA_GET_O(p->device, kAudioDevicePropertyLatency, &latency_frames);
- if (err != noErr) {
+ uint32_t latency_properties[] = {
+ kAudioDevicePropertyLatency,
+ kAudioDevicePropertyBufferFrameSize,
+ kAudioDevicePropertySafetyOffset,
+ };
+ for (int n = 0; n < MP_ARRAY_SIZE(latency_properties); n++) {
+ uint32_t temp;
+ err = CA_GET_O(p->device, kAudioDevicePropertyLatency, &temp);
CHECK_CA_WARN("cannot get device latency");
- latency_frames = 0;
+ if (err == noErr)
+ latency_frames += temp;
}
p->hw_latency_us = ca_frames_to_us(ao, latency_frames);