WebRTC SDP

Summary

This document describes the Session Description Protocol (SDP) in the WebRTC standard.

Before the WebRTC applications on the two browsers start to transmit audio and video data, they need to use the RTCPeerConnection object to establish a session.

The main purposes of establishing a session are as follows:

1. Describe the session name and session duration.

2. Negotiate audio and video codec standards (such as: Opus, G722, VP8), audio sampling rate and channel number, audio frame duration, etc.

3. Negotiate network communication quality feedback and improvement strategies, such as: which congestion control algorithm to use, whether to enable NACK, FEC, etc.

4. Negotiate network security mechanisms and related parameters, such as: ICE username and password, DTLS certificate fingerprint, DTLS user role, etc.

5. Collect network transmission candidates and build a CandidatePair list.

6. According to the CandidatePair list and the priority rules configured by the user, try to establish connections one by one until the first connection is successfully established.

WebRTC does not know how to transmit audio and video data before session-related parameters have been negotiated.

How does WebRTC describe session-related parameters? The answer is to use SDP.

SDP is an extensible specification. The SDP in WebRTC is extended based on the standard SDP specification.

Standard SDP specification

SDP is the abbreviation of Session Description Protocol.

The SDP description consists of many text lines. The format of the text lines is defined as: <key>=<value>[CRLF]

<key> is an English letter, <value> is a structured text string, and the format of <value> depends on <key>.

SDP specification in WebRTC

WebRTC has expanded the standard SDP specification and defined two sets of specifications: PlanB and UnifiedPlan.

The main difference between these two sets of specifications is: in PlanB, the same type of m can only appear once, and multiple instances of the same type of m need to be distinguished by cname aliases; in UnifiedPlan, each type of m (for example: m=video) Multiples may occur and each instance must be described separately. UnifiedPlan describes media more clearly than PlanB.

Core functions of SDP

The core of SDP has two functions: session description and media description.

Common keywords used in conversation description: v, o, s, t.

Commonly used keywords in media description: m, a.

The full name of m is media (media), which is used to describe an independent media (which can be understood as MediaStreamTrack).

The full name of a is attribute (attribute), which is used to supplement the compression coding and network transmission parameters of the media described by the m keyword.

Other commonly used keywords and their uses are shown in the following figure:

ORTC specification

Many scholars believe that it is not appropriate to use the ancient SDP to describe the session in the trendy WebRTC API.

The ORTC (Object Real-Time Communication) organization led by Microsoft proposed a new WebRTC API standard ORTC.

ORTC adopts an object-oriented design and disperses interfaces into objects such as Sender, Receiver, and Transport.

In ORTC, some original concepts of WebRTC (such as: SDP, Offer/Answer, RTCPeerConnection, etc.) have disappeared.

Summarize

This article introduces the role of SDP in the WebRTC standard and looks forward to the future of the WebRTC API standard.

Guess you like

Origin blog.csdn.net/bigwave2000/article/details/132258189