-
The function getCurrentOutputLatencyMillis shows the average latency of the audio stream between data entering the stream and it being presented to the audio device so basically it is buffering latency + transmission latency right? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Your description of the latency is correct.
You can measure the amount of data currently in the buffer by subtracting:
But please do not call getFramesRead() from a callback. On older systems, that can cause a race condition. It is OK to call it from another thread outside the callback. Also note that the latency will jump up every time you write into the buffer and then slowly drop as the audio is played out the speaker. So it looks like a sawtooth: |||\ |
Beta Was this translation helpful? Give feedback.
-
(Since people have more questions, I am converting this to a discussion.)
No. AAudioStream_getBufferSizeInFrames() tells you the maximum amount of data that can be in the buffer. AAudioStream_getBufferCapacityInFrames() is the amount of memory allocated for the buffer. |
Beta Was this translation helpful? Give feedback.
-
can we write using aaudio and capture at lower layer via ALSA loopback? |
Beta Was this translation helpful? Give feedback.
-
No. ALSA loopback is not available on Android. There are privacy issues and the HAL hides ALSA. |
Beta Was this translation helpful? Give feedback.
-
Can we use these streams for streaming over rtp ? (after converting it to AudioStream which carrys audio payloads over RTP because mediarecorder use Audiostream(rtp stream) for streaming) |
Beta Was this translation helpful? Give feedback.
Your description of the latency is correct.
You can measure the amount of data currently in the buffer by subtracting:
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…