mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +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:
@@ -501,10 +501,17 @@ static int init_digital(struct ao *ao, AudioStreamBasicDescription asbd)
|
|||||||
p->stream_asbd.mFramesPerPacket);
|
p->stream_asbd.mFramesPerPacket);
|
||||||
|
|
||||||
uint32_t latency_frames = 0;
|
uint32_t latency_frames = 0;
|
||||||
err = CA_GET_O(p->device, kAudioDevicePropertyLatency, &latency_frames);
|
uint32_t latency_properties[] = {
|
||||||
if (err != noErr) {
|
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");
|
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);
|
p->hw_latency_us = ca_frames_to_us(ao, latency_frames);
|
||||||
|
|||||||
Reference in New Issue
Block a user