What's the correct way to measure latency of audio input and output?
What's the correct way to measure latency of audio input and output?
- Subject: What's the correct way to measure latency of audio input and output?
- From: Dale Curtis <email@hidden>
- Date: Fri, 28 Jul 2017 16:30:44 -0700
I.e. if a sound occurs at time T, how can we determine T during the
eventual AURenderCallbackStruct::inputProc() callback delivering that audio
data?
In Chrome we've always done this by roughly the following calculation:
T = inTimeStampReceivedByInputProc->mHostTime -
AudioUnitGetProperty(kAudioUnitProperty_Latency) -
AudioObjectGetPropertyData(kAudioDevicePropertyLatency);
https://cs.chromium.org/chromium/src/media/audio/mac/audio_low_latency_input_mac.cc?l=1059
Is this actually correct? Specifically, I wonder if we really need to
manually include the two latency properties or if those are already baked
into the provided AudioTimeStamp?
Similarly, for output if we render a sound at time T, we expect it to play
at T = inTimeStampReceivedByInputProc->mHostTime +
AudioUnitGetProperty(kAudioUnitProperty_Latency) +
AudioObjectGetPropertyData(kAudioDevicePropertyLatency)
https://cs.chromium.org/chromium/src/media/audio/mac/audio_auhal_mac.cc?l=392
The playout case seems more reasonable to need to include the additional
latency fields, but again I can't find any documentation suggesting what is
actually correct. Thanks in advance for any clarity!
- dale
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden