# SDP

> The SDP (Session Description Protocol) is a text format that describes media sessions, such as codecs, formats and network details.

## What is SDP in WebRTC?

The text format used in WebRTC offers and answers to describe a session: which audio and video tracks exist, which codecs are supported and how to reach the peer. Peers compare their SDP to agree on common settings.

- Topic: Real-Time Communication
- Type: protocol

## Common mistakes

- Manually modifying SDP strings, which breaks easily between browser versions.

## Key points

- The code passes SDP objects between peers as they are, without editing the text by hand.
- An answer is created only after the remote offer has been set.

## Interview questions

### What are an SDP offer and answer?

The caller creates an offer with its tracks and codecs, the callee replies with an answer that picks what both support.

### What does an m= line in SDP mean?

It starts a media section, such as 'm=audio' or 'm=video', listing the port, transport and payload types for one track.

### How do I change codecs without editing SDP?

Use `RTCRtpTransceiver.setCodecPreferences()` before creating the offer, and `RTCRtpSender.setParameters()` for bitrate.

## Related cards

- [Signaling](https://wonderium.dev/web/signaling.md)
- [WebRTC](https://wonderium.dev/web/webrtc.md)
- [RTCPeerConnection](https://wonderium.dev/js/rtc-peer-connection.md)

---

- Level: [Web Platform](https://wonderium.dev/web.md)
- HTML version: https://wonderium.dev/web/sdp
- Last updated: 2026-11-25
