mirror of https://github.com/mpv-player/mpv
ao_coreaudio: fix nan in ca_get_device_latency_ns
This commit is contained in:
parent
c365e2f7b1
commit
c3d9243a3e
|
@ -442,12 +442,14 @@ int64_t ca_get_device_latency_ns(struct ao *ao, AudioDeviceID device)
|
|||
}
|
||||
}
|
||||
|
||||
double sample_rate = ao->samplerate;
|
||||
double sample_rate;
|
||||
OSStatus err = CA_GET_O(device, kAudioDevicePropertyNominalSampleRate,
|
||||
&sample_rate);
|
||||
CHECK_CA_WARN("cannot get device sample rate, falling back to AO sample rate!");
|
||||
if (err == noErr) {
|
||||
MP_VERBOSE(ao, "Device sample rate: %f\n", sample_rate);
|
||||
} else {
|
||||
sample_rate = ao->samplerate;
|
||||
}
|
||||
|
||||
return MP_TIME_S_TO_NS(latency_frames / sample_rate);
|
||||
|
|
Loading…
Reference in New Issue