Skip to main content

Module jitter

Module jitter 

Source
Expand description

A jitter buffer.

The network delivers packets late, early, twice, or not at all. Audio needs them evenly spaced and in order. The buffer trades a fixed amount of latency for that, and the whole design question is how much.

Two of them, and the fixed one is not a stepping stone that got left behind. It is the control: an adaptive buffer that cannot be shown to beat a constant on a bad network and to match it on a good one is just a constant with extra machinery and extra ways to be wrong.

The asymmetry that shapes the adaptive policy: being too shallow is audible, being too deep is not. A packet that arrives after its slot was played is a gap in the audio; a buffer holding one packet more than it needs is 20 ms of latency nobody notices. So it grows at the first sign of trouble and shrinks only on sustained evidence that the trouble is over.

Shrinking costs nothing here, which is worth being explicit about because it is the part people expect to be hard. At packet granularity, lowering the depth means the next packet is released one slot sooner — it is not dropped, and nothing is played faster. Time-scale modification of the audio belongs in the media layer; this layer removes latency simply by holding less of it.

Structs§

JitterBuffer
Buffers packets, reorders them, and reports what went missing.