SDP Inspector
The Session Description Protocol (SDP) is the "contract" between two peers. It is a dense, text-based document that describes every technical capability of a browser, from the video codecs it supports to the security keys it uses.
The Goal: Agreeing on a Common Language
Imagine you speak French and English, and your friend speaks English and Spanish. To communicate, you first need to agree to speak English. In WebRTC, the SDP is how browsers reach this agreement. If one browser only supports VP8 video and the other only supports H.264, the SDP exchange will fail because they have no common "language."
Anatomy of a Session Description
An SDP is divided into sections. The top is the Session Level (global settings), followed by Media Levels (one for every audio or video track).
1. The Media Line (m-line)
This is the most critical line. It defines the type of media (audio/video), the protocol, and the format.
m=video 9 UDP/TLS/RTP/SAVPF 96 97
2. Attribute Lines (a-line)
This is where the detailed configuration lives: security fingerprints, ICE passwords, and specific codec names.
Decoding the Metadata
| Component | Line Example | Why it matters |
|---|---|---|
| Codecs | a=rtpmap:96 VP8/90000 |
Tells the peer: "I know how to decode VP8 video." |
| Security | a=fingerprint:sha-256 ... |
The cryptographic lock used to secure the pipe. |
| Direction | a=sendrecv |
Defines if the track is two-way, or one-way (broadcast). |
| ICE Creds | a=ice-ufrag:xyz123 |
The username the peer must use to talk to your ICE agent. |
Munging
"SDP Munging" is the practice of manually editing the SDP string before calling setLocalDescription.
- The Why: You might want to force a lower bitrate (
b=AS:500) or disable a specific codec that you know is buggy on a certain device. - The Risk: Munging gives precise control but is fragile. If you make a typo in the SDP string, the
RTCPeerConnectionwill simply refuse to connect.
Dive into the Signaling Flow to see how these contracts are exchanged.