Adaptive Bitrate and Congestion Control
Learn how WebRTC adapts media quality in real time using congestion control algorithms and simulcast to keep calls smooth on changing networks.
Adaptive Bitrate and Congestion Control is a free Real-Time Streaming Systems (WebRTC + Live Data) lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Real-Time Streaming Systems (WebRTC + Live Data) learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Networks Are Never Stable
Real-time media runs over networks that fluctuate constantly: Wi-Fi dips, cellular handoffs, shared bandwidth. A fixed bitrate will either waste capacity or overwhelm a weak link.
Adaptive bitrate lets the sender match its output to current conditions.
Signals of Congestion
WebRTC infers congestion from feedback:
- Packet loss reported via RTCP.
- Increasing delay (jitter and one-way delay growth).
- Receiver estimates of available bandwidth.
Google Congestion Control
The core algorithm in WebRTC is GCC (Google Congestion Control). It combines a loss-based controller and a delay-based controller to estimate the safe sending rate.
Delay-Based Estimation
The delay-based part watches how packet arrival times drift. If packets start queuing up, that growing delay signals congestion before loss even happens, so the sender can back off early.
Loss-Based Estimation
The loss-based controller reacts to RTCP loss reports. Above a threshold it lowers the rate; with little loss it slowly probes upward to reclaim bandwidth.
Trading Resolution for Frame Rate
When bandwidth drops, the encoder must shed bits. It can lower resolution (softer image) or frame rate (choppier motion). WebRTC chooses based on content: video calls favor smoothness, screen shares favor sharpness.
Simulcast to the Rescue
With simulcast, a sender encodes the same video at several qualities at once. The SFU forwards the layer each receiver can handle, so one weak viewer does not degrade everyone.
const sender = pc.addTransceiver(track, {
sendEncodings: [
{ rid: 'low', scaleResolutionDownBy: 4 },
{ rid: 'mid', scaleResolutionDownBy: 2 },
{ rid: 'high', scaleResolutionDownBy: 1 }
]
});Reading Bandwidth from Stats
You can observe the estimate via getStats(), watching available outgoing bitrate and current send rate to drive UI warnings.
const stats = await pc.getStats();
stats.forEach(r => {
if (r.type === 'outbound-rtp') {
console.log('bitrate', r.targetBitrate);
}
});Setting Bitrate Caps
You can bound the encoder so it never exceeds a ceiling, useful for cost control or guaranteeing other traffic gets bandwidth.
const params = sender.getParameters();
params.encodings[0].maxBitrate = 500000;
await sender.setParameters(params);FEC and Retransmission
To survive loss without dropping quality, WebRTC uses FEC (forward error correction) and selective retransmission (NACK/RTX). These add overhead but protect against lossy links.
Tuning for Your Use Case
- Conferencing: prioritize low latency and smoothness.
- Broadcast: allow a larger buffer for stability.
- Screen share: protect resolution over frame rate.
Quick Check
Test your understanding of adaptive bitrate.
Recap
WebRTC adapts bitrate using GCC's delay- and loss-based estimates, trades resolution for frame rate as needed, and uses simulcast plus FEC/retransmission to keep calls smooth across unstable networks.
Frequently asked questions
Is the “Adaptive Bitrate and Congestion Control” lesson free?
Yes — the full text of “Adaptive Bitrate and Congestion Control” is free to read here on the web, and the Real-Time Streaming Systems (WebRTC + Live Data) course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Real-Time Streaming Systems (WebRTC + Live Data) course, upgrade to CoddyKit PRO.
What will I learn in “Adaptive Bitrate and Congestion Control”?
Learn how WebRTC adapts media quality in real time using congestion control algorithms and simulcast to keep calls smooth on changing networks. You practise Real-Time Streaming Systems (WebRTC + Live Data) with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Real-Time Streaming Systems (WebRTC + Live Data)?
No prior experience is required. Real-Time Streaming Systems (WebRTC + Live Data) on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Adaptive Bitrate and Congestion Control” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Real-Time Streaming Systems (WebRTC + Live Data) lesson?
Yes. Every Real-Time Streaming Systems (WebRTC + Live Data) lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- WebRTC Security Best Practices
- Optimizing Media Quality
- Bandwidth Management Techniques
- Adaptive Bitrate and Congestion Control