Skip to content

calculating transmission latency #1130

Answered by philburk
bazookam7 asked this question in Q&A
Discussion options

You must be logged in to vote

Your description of the latency is correct.

Suppose buffer size = 2*burst size , how to measure transmission latency in this case

You can measure the amount of data currently in the buffer by subtracting:

    framesInBuffer = stream->getFramesWritten() - stream->getFramesRead();
    bufferLatencyMillis = 1000 * framesInBuffer / sampleRate;
    transmissionLatencyMillis = measuredLatencyMillis - bufferLatencyMillis;

But please do not call getFramesRead() from a callback. On older systems, that can cause a race condition.
https://github.com/google/oboe/blob/master/docs/notes/rlsbuffer.md

It is OK to call it from another thread outside the callback.

Also note that the latency will jump up…

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by philburk
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #1130 on December 12, 2020 19:39.