Keeping call audio in step between two threads
Why the Verus Android call engine guards its audio buffer. Plus the test I required to fail without the guard before accepting it.
What I tried
Incoming call audio waits in a buffer until it is due to play. In the first Android version, receiving and playing touched that buffer independently.
Why I chose differently
Between one thread looking and the other acting, the buffer could change underneath it. A live call needs it consistent at every moment.
What I chose
I guarded the buffer so the two can never act on it at once, arranged so the guard cannot stall a call. I only accepted the test once I had seen it catch the unguarded version, because a test that cannot fail proves nothing. Calls have run cleanly since.
The principle
If another thread can act between a check and a read, make them one step.
- Concurrency
- Kotlin
- Jitter buffer
- VoIP