Bitrate adattivo e controllo della congestione
Impari come WebRTC adatti la qualità dei media in tempo reale usando algoritmi di controllo della congestione e simulcast per mantenere fluide le chiamate su reti variabili.
Bitrate adattivo e controllo della congestione è una lezione Real-Time Streaming Systems (WebRTC + Live Data) gratuita su CoddyKit. Questa è la lezione 4 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Real-Time Streaming Systems (WebRTC + Live Data), e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Real-Time Streaming Systems (WebRTC + Live Data) include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
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.
Impara Real-Time Streaming Systems (WebRTC + Live Data) con un tutor IA — gratis
Scrivi ed esegui vero codice nel tuo browser, ricevi aiuto istantaneo da un tutor IA disponibile 24/7, e riprendi da dove hai lasciato sul web o nell'app.
- Corsi
- 12
- Lezioni
- 48
Domande Frequenti
La lezione «Bitrate adattivo e controllo della congestione» è gratuita?
Sì — il testo completo di «Bitrate adattivo e controllo della congestione» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Real-Time Streaming Systems (WebRTC + Live Data), passa a CoddyKit PRO. Il corso Real-Time Streaming Systems (WebRTC + Live Data) include 4 lezioni in totale.
Cosa imparerò in «Bitrate adattivo e controllo della congestione»?
Impari come WebRTC adatti la qualità dei media in tempo reale usando algoritmi di controllo della congestione e simulcast per mantenere fluide le chiamate su reti variabili. Eserciti Real-Time Streaming Systems (WebRTC + Live Data) con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare Real-Time Streaming Systems (WebRTC + Live Data)?
Non è richiesta alcuna esperienza precedente. Real-Time Streaming Systems (WebRTC + Live Data) su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 4 di 4.
Quanto tempo richiede la lezione «Bitrate adattivo e controllo della congestione»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione Real-Time Streaming Systems (WebRTC + Live Data)?
Sì. Ogni lezione Real-Time Streaming Systems (WebRTC + Live Data) include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- Best practice per la sicurezza WebRTC
- Ottimizzazione della qualità multimediale
- Tecniche di gestione della larghezza di banda
- Bitrate adattivo e controllo della congestione