Rich mobile content (video, high‑res images, embedded media) is delivered in short chunks, each independently encodable at several quality tiers — a "bitrate ladder". A client‑side ABR (adaptive bitrate) algorithm decides, chunk by chunk, which tier to fetch next.
1. Measure throughput of each finished chunk:
T_i = chunkSizeBits / downloadTime_i
2. Estimate available bandwidth (harmonic mean
of the last 5 samples — punishes recent drops
harder than a plain average):
T_est = n / Σ(1 / T_i)
3. Apply a safety margin m (< 1 = conservative):
capacity = T_est × m
4. Pick the highest ladder rung with
bitrate(rung) ≤ capacity
5. Buffer‑based override: if buffer < 5 s,
force the lowest rung regardless of (4) —
protect against a stall over raw quality.
- Buffer is seconds of already‑downloaded playback waiting to be shown. It rises by one chunk‑duration each time a chunk finishes, and drains in real time during playback. It caps at 30 s — a full client won't keep prefetching.
- Rebuffer / stall happens when buffer hits 0 before the next chunk arrives; playback pauses and only resumes once ~2 s has re‑buffered. Each 0‑hit is counted once as one event.
- The chart on the right runs this same adaptive stream side‑by‑side against a naive Always Max stream fed the identical bandwidth trace, so the rebuffer‑event counters below are a genuine, measured comparison, not scripted numbers.
This is the same family of algorithm (throughput‑rule + buffer‑rule) used by real HLS/DASH players and CDN‑backed mobile apps to keep rich content smooth without over‑ or under‑spending a user's mobile data budget.