mirror of
https://github.com/mpv-player/mpv
synced 2025-03-25 04:38:01 +00:00
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.
This commit is contained in:
parent
025cb3b9e3
commit
5f86fad2f0
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user