WebRTC Latency Is Not One Number: Six Observation Points From ICE to Jitter Buffer
A one-number view of WebRTC latency sends a debugging team after the wrong hop, while a 1.4 second A/V gap actually lives in the jitter buffer. The six-threshold protocol and 30-round sampling routine put the cost in terms a developer can fix: buffer size, relay selection, bitrate, CPU.
WebRTC latency is the sum of four stages with different measurement hooks: capture plus encode (30-80 ms), network transport (20-150 ms), jitter buffering (20-200 ms), and decode plus render (10-50 ms). A real incident from a 500-person live session placed encoding, bandwidth, and servers inside normal range while the audience saw a stable 1.4 second A/V gap. The cause was a receiver-side jitter buffer: 0.3% packet loss but 68 ms inter-arrival jitter pushed the buffer past 240 ms, and after two-hop relay the lag locked in.
The debugging protocol calls for one getStats sample per second for 30 consecutive rounds. Three fields deserve careful reading: jitter is RTP inter-arrival variance per RFC 3550, not latency; the actual buffering cost comes from jitterBufferDelay / jitterBufferEmittedCount; and packetsLost is cumulative, so a retransmit does not lower it. Thresholds map symptoms to causes: RTT above 150 ms implicates a TURN relay or physical distance; loss above 2% separates Wi-Fi airloss from uplink congestion using transport bytesSent growth; jitter above 30 ms for five seconds flags cross-ISP or multi-hop paths; a jitterBufferDelay average above 200 ms means the receiver is exchanging smoothness for latency; freezeCount increases point at decode CPU; and totalEncodeTime above the frame interval means the sender needs lower bitrate, not more bandwidth.
Reproduction on the link uses Linux tc netem to inject 20 ms normal-distribution jitter and 1% loss on loopback, Wireshark RTP analysis for sequence gaps and arrival times, and chrome://webrtc-internals to record before/after series. To make comparisons meaningful, collection keeps only the six named fields and stamps region, network type, and version; dumping the whole getStats object destroys comparability because field sets change between versions. The resolution order is then straightforward: confirm each stage's upper bound, adjust the corresponding control, and turn the six observations into a pre-release dashboard.
The 0.3% packet loss with 68 ms jitter case shows network health metrics can look clean while the receive buffer is the bottleneck; teams that only watch loss or RTT miss it.
Naming jitter as a delay metric is a trap; the RTP jitter field is variance, and the ratio with emitted count is the number that matches observed buffering.
Collecting fewer fields deliberately, instead of storing full getStats state, sacrifices forensic detail for longitudinal comparability across versions.
The picture lags the sound by 1.4 seconds. After checking everything, it turned out the jitter buffer was blown up. That root-cause hunt is ruthless enough. With the six thresholds laid out, sampling 30 rounds is enough to locate the issue. The approach is practical.