SDP 消息格式

SDP 消息格式

SIP 协议详解 中提到过一种Sip body消息体格式message/sdp,这一节来了解一下SDP消息格式。

  • SDP(Session Description Protocol)是一种会话描述的数据格式
    RFC4566 中有这样一断描述:
    SDP is purely a format for session description -- it does not incorporate a transport protocol, and it is intended to use different transport protocols as appropriate, including the SAP(Session Announcement Protocol) ,SIP(Session Initiation Protocol) , RTSP(Real Time Streaming Protocol) ,electronic mail using the MIME extensions, and the Hypertext Transport Protocol.
    翻译过来大概是:
    SDP(Session Description Protocol)是一种纯粹的会话描述的格式。 SDP不是传输协议,信息传输上,其适当使用不用协议完成,包括:SAP,SIP,RTSP,HTTP,MIME协议扩展。
  • SDP 通常用在会话初始化过程中,用来传送会话参与者的能力列表,以协调会话双方的各项参数。例如:媒体的种类为 audio 或 video ;媒体的编码方式(H.261 video、MPEG video 等) 。

SDP举例:

Session description
   v=0
   o=jdoe 2890844526 2890842807 IN IP4 10.47.16.5
   s=SDP Seminar
   i=A Seminar on the session description protocol
   u=http://www.example.com/seminars/sdp.pdf
   e=j.doe@example.com (Jane Doe)
   c=IN IP4 224.2.17.12/127
   t=2873397496 2873404696
   a=recvonly
   m=audio 49170 RTP/AVP 0
   m=video 51372 RTP/AVP 99
   a=rtpmap:99 h263-1998/90000

Time description
   t=3034423619 3042462419
   r=604800 3600 0 90000

Media description
   m=video 49170/2 RTP/AVP 31

SDP协议的结构如下:

Session description
   v=  (protocol version)
   o=  (originator and session identifier)
   s=  (session name)
   i=* (session information)
   u=* (URI of description)
   e=* (email address)
   p=* (phone number)
   c=* (connection information -- not required if included in
        all media)
   b=* (zero or more bandwidth information lines)
   One or more time descriptions ("t=" and "r=" lines; see below)
   z=* (time zone adjustments)
   k=* (encryption key)
   a=* (zero or more session attribute lines)
   Zero or more media descriptions

Time description
   t=  (time the session is active)
   r=* (zero or more repeat times)

Media description, if present
   m=  (media name and transport address)
   i=* (media title)
   c=* (connection information -- optional if included at
        session level)
   b=* (zero or more bandwidth information lines)
   k=* (encryption key)
   a=* (zero or more media attribute lines)

Session description

Type含义解释举例
vprotocol versionSDP的版本号v=0
oorigion会话发起者的描述o={用户名}{session id} {会话版本} {网络类型}{地址类型}{地址}
sSession Name会话名,在整个会话中有且只有一个”s=”s=SDP Seminar
isession information会话的文本描述信息i=A Seminar on the session description protocol
uURIThe URI should be a pointer to additional information about the session.u=http://www.example.com/seminars/sdp.pdf
eEmail Address and Phone Numberspecify contact information for the person responsible for the conferencee=j.doe@example.com (Jane Doe)
cConnection Datathe connection type and addressc=IN IP4 224.2.17.12/127
bBandwidththe proposed bandwidth to be used by thesession or mediac=IN IP4 224.2.17.12/127

Time description

Type含义解释举例
tTimingspecify the start and stop times for a sessiont={开始时间} {结束时间}
rRepeat Timesspecify repeat times for a sessionr={重复间隔}{活动时长}{启动时间偏移}

Media description

Type含义解释举例
mmedia name and transport addressm={media}{port}{proto}{fmt}m=video 49170/2 RTP/AVP 31

参考

RFC4566:https://tools.ietf.org/html/rfc4566

SDP协议介绍:https://www.cnblogs.com/idignew/p/7249056.html

bjxiaxueliang CSDN认证博客专家 Java OpenGL Android
一名普通Android程序员,专注Android、OpenGL ES、移动音视频等终端技术研发。
希望通过该博客分享自己的Android Coding心路。
©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页
实付 29.90元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值