ThinkSSL🔒 一键申购 5分钟快速签发 30天无理由退款 购买更放心 广告
[TOC] ## 【实战】使用SDP实例 ## SDP规范 它是一种信息格式的描述标准,本身不属于传输协议, 但是可以被其他传输协议用来交换必要的信息。 ### 会话层 * 回话的名称与目的 * 会话的存活时间 * 会话中包括多个媒体信息 ### 媒体信息 * 媒体格式 * 传输协议 * 传输IP和端口 * 媒体负载类型 ## Session Description ``` v = (protocol version) o =(owner/create and session identifier) s=(session name) c =*(conn info-optional if included at session-level) a=*(zero or more session attribute lines) ``` ## Time Description ``` * t=(time the session is active) r=*(zero or more repeat times) ``` ## Media Description ``` * m=(media name and transport address) * c=*(conn info-optional if included at session-level) * b=*(bandwidth information) * a=*(zero or more session attribute lines) ``` ## 字段含义 ### Version 必选: ``` v=0 SDP的版本号,不搞扩次版本号 ``` ### Session Name必选 ``` s=< session name> 会话名,s=-表示忽略会话名 ``` Origion/Owner必选: ``` o=<username><session id><version><network type><address type><address> 例子: o=- 7017624586836067756 2 IN IP4 127.0.0.1 ``` ### Connection Data可选 ``` c = <network type><address type><connection address> 例子:c=IN IP4 0.0.0.0 ``` ### Media Announcements必选 ``` m = <media><port><transport><fmt/payload type list> 例子:m= audio 1024 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 126 ``` Suggested Attributes可选: ``` a=<TYPE>或a=<TYPE>:<VALUES> 例子:a=framerate:<帧速率> ``` **rtpmap**可选: ``` a = rtpmap:<fmt/payload type><encoding name>/<clockrate>[/<encodingparameters>] 例子:a=rtpmap:103 ISAC/16000 ``` **fmtp**可选: ``` a=fmtp:<format/payload type> parameters 例子:a=fmtp:103 apt=106 ``` ## webrtc 中的SDP ### SDP组成 会话元 ``` v= o= t= ``` 网络描述 ``` c= a=candidate ``` 流描述 ``` m= a=rtpmap a=fmtp ``` 安全描述 ``` a=crypto a=ice-frag a=ice-pwd a=fingerprint ``` 服务质量 ``` a=rtcp-fb 反馈 a=group a=rtcpmux 复用 ```