-
Notifications
You must be signed in to change notification settings - Fork 572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add method to obtain latency of a stream #69
Comments
The latency varies depending on how many frames are buffered between the app and the DAC. If the app writes N frames to AAudio then the latency will jump up immediately by N frames. The latency will then go down smoothly by sampleRate frames per second until something underflows or the app writes more data. If the app runs with a nearly full buffer then the latency will be higher than if it runs with a nearly empty buffer. We can calculate a maximum latency that assumes full buffers all the way down. But the instantaneous latency will generally be lower. If we add a function to Oboe then a good name might be calculateInstantaneousLatency() or calculateCurrentLatency(). |
Here is code to measure latency using timestamps.
|
This was moved from an internal Android bug tracker.
For many developers knowing the latency of a stream is more important than obtaining very low latency.
For example, in karaoke apps, the latency of the recording and playback streams must be known in order to synchronise the user's recorded voice over the backing track.
Another example is recording in Audio Workstation apps (DAWs), the recorded audio must be synchronised with the current track. Doing this requires knowing the latency of the recording and playback streams.
We could add the following method to a utility.
int32_t getLatency()
which returns the latency of the stream in microseconds or nanoseconds (milliseconds does not have sufficient precision).
The text was updated successfully, but these errors were encountered: