SD System Design In Depth
0%
lesson system-designmediarealtime

Live streaming, WebRTC, and latency

Module 5.2: Media Processing & CDN Distribution Updated Sep 18, 2026
📄 Cheat Sheet
How Does Live Streaming Platform Work? (YouTube live, Twitch, TikTok Live)
ByteByteGo How Does Live Streaming Platform Work? (YouTube live, Twitch, TikTok Live) Watch on YouTube ↗

Kept: a concise, accurate map of the live pipeline (ingest, transcode, package, CDN) and where each second of latency comes from.

0:00 / --:--

The Latency Spectrum in Video Delivery

Different streaming use cases require drastically different latencies:

  • Standard Live (HLS/DASH): 15–30 seconds latency. High CDN cacheability, ideal for sports broadcasts.
  • Low-Latency HLS (LL-HLS) / CMAF: 2–4 seconds latency. Good for interactive sports and Twitch-style gaming.
  • Ultra-Low Latency (WebRTC): < 500 milliseconds. Required for video conferences (Zoom, Google Meet) and interactive bidding.

WebRTC vs. HTTP Streaming

WebRTC commonly carries SRTP media over UDP selected through ICE, but it can fall back through TURN over TCP or TLS when networks block UDP. Receivers use jitter buffers, and implementations may request selected retransmissions with NACK while congestion control trades quality against delay; no transport guarantees conversation latency. A peer-to-peer mesh is practical only for small calls. An SFU is an alternative topology that receives each participant's stream and forwards selected layers, while very large passive audiences often use HTTP-based low-latency streaming.

Worked example: three latency budgets

  • Classic HLS: encoder and packaging about 2 s, one full 6 s segment must finish before it is published, the CDN adds about 1 s, and the player buffers 3 segments (18 s). Total roughly 20 to 30 s.
  • Low-Latency HLS: segments are split into partial segments of about 200 to 500 ms; the player uses blocking playlist reloads and preload hints to request parts as soon as they exist, and keeps a buffer of a few parts. Total roughly 2 to 5 s.
  • WebRTC: capture about 30 ms, encode about 20 ms, network 50 to 150 ms, jitter buffer 50 to 100 ms, decode and render about 20 ms. Total roughly 200 to 350 ms, with no segment waiting at all.

Group call topology

In a 10-person mesh, each participant sends 9 copies of a 1.5 Mbit/s stream: 13.5 Mbit/s of upload, which most home connections cannot sustain. With an SFU, each participant uploads once (or 3 simulcast layers, for example 1.5, 0.5 and 0.15 Mbit/s) and the SFU forwards the right layer to each receiver based on their bandwidth and window size. An MCU mixes streams into one, saving client bandwidth at a high server CPU cost.

Protocol comparison

ProtocolTypical latencyAudience scaleCDN cacheableTypical use
HLS or DASH10 to 30 sTens of millionsYesSports and events broadcast
LL-HLS or low-latency DASH (CMAF chunks)2 to 5 sMillionsYes, with CDN support for blocking requestsInteractive streams, Twitch-style
WebRTC via SFUunder 0.5 sThousands per SFU cluster, more with cascadingNoCalls, auctions, betting, co-streaming
RTMP, SRT or WHIP ingestContributes 0.1 to 2 sOne publisherNot applicableGetting video from the streamer to the platform

How real systems do it

  • Disney+ Hotstar served tens of millions of concurrent cricket viewers over HTTP streaming through multiple CDNs, pre-scaling capacity ahead of matches.
  • Amazon IVS offers low-latency HLS for large audiences and separate WebRTC-based real-time stages for interactive guests, reflecting the same split.
  • WHIP and WHEP are IETF work that standardize WebRTC ingest and playback signalling over HTTP, making WebRTC easier to plug into streaming pipelines.
Check yourself Question 1 of 3
What an SFU does recall
From: WebRTC vs. HTTP Streaming

In a WebRTC group call, what does a selective forwarding unit (SFU) do with each participant's stream?

Key Takeaways

Understand the trade-off: HTTP chunk streaming offers high CDN cacheability but higher latency (2–15s); WebRTC offers sub-500ms latency but requires complex SFU server infrastructure.
Prefer UDP media for real-time interaction while supporting ICE/TURN fallbacks and bounded retransmission, jitter, and congestion-control behavior.
For large interactive broadcasts, use WebRTC for the active broadcaster and Low-Latency HLS (LL-HLS) for millions of passive viewers.
Was this lesson helpful? Spot an issue or have a suggestion? Let us know on GitHub.
Report an issue