Most WebRTC confusion comes from mixing layers that do different jobs. Treat each layer separately and debugging becomes a sequence instead of guesswork.
Question
What are the layers of the WebRTC stack, and where should I debug first?
Quick answer
WebRTC is three cooperating systems:
- Signaling plane: helps peers exchange session details.
- Connectivity plane (ICE/STUN/TURN): finds a usable network path.
- Media/data plane: carries encrypted audio, video, and data.
If you debug all three as one blob, you lose hours.
Mental model
Think of signaling as setup chat, ICE as route finding, and media transport as delivery.
- Signaling can fail while media code is perfect.
- ICE can fail even when signaling succeeds.
- Media quality can degrade even when connection setup works.
Each layer has different telemetry and different failure signatures.
Layer-to-symptom map
| Symptom | Most likely layer | First check |
|---|---|---|
| Call invite works but peers never connect | Connectivity (ICE/STUN/TURN) | Candidate gathering and selected pair state |
| Connection establishes but no media flows | Media/data plane | Track state, codec negotiation, bitrate/packet loss |
| Random call setup failures by network type | Connectivity + signaling | Offer/answer timing and relay candidate usage |
| Stable setup but degraded quality | Media/data plane | RTT, packet loss, jitter, bitrate adaptation |
What to log first
- offer/answer exchange timestamps,
- ICE candidate state transitions,
- bitrate, packet loss, and RTT after connect.
This gives you a timeline instead of guesswork.
Debug order that saves time
- Confirm signaling exchange integrity.
- Confirm ICE candidate gathering and selection.
- Confirm media/data transport health.
Never start with bitrate tuning before layer 1 and 2 are proven healthy.
10-minute action step
- Capture one failing and one successful session log from your signaling layer.
- Trace offer/answer, ICE, and candidate events in strict timestamp order.
- Mark the first divergence point and tie it to one concrete fix.
- Re-test with the same network path and verify behavior is deterministic.
Success signal
You can identify exactly where negotiation broke and prove the same class of failure no longer reproduces.



