SSRC 广播的时候如何处理

1.a字段
1.1 crypto属性
 a = crypto:<tag> <crypto-suite> <key-params> [<session-params>]
1
​ a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32

标签:用于在offer/answer中选择一种crypto属性

加密套件:描述加密的标识符和身份验证算法

关键参数:method:info。目前method只有一种定义“inline”,表明秘钥就是info

会话参数:

参考自:https://tools.ietf.org/html/rfc4568#section-4

1.2 ssrc属性
a = ssrc:<ssrc-id> <attribute>:<value>
1
​ a=ssrc:2 cname:stream_1_cname

​ a=ssrc:2 label:video_track_id_1

attribute包括:cname(唯一标识一个客户端,一个客户端只有一个cname)

​ msid

​ mslabel

​ label

​ fmtp

参考自:https://tools.ietf.org/html/rfc5576#section-4

备注:label属性,可以参考:https://www.packetizer.com/rfc/rfc4574/

1.3 ssrc-group属性
 a=ssrc-group:<semantics> <ssrc-id> ...
1
a=ssrc-group:FEC 2 3

semantics:有FID(流识别),FEC(前向纠错),SIM(用于simulcate)。

FID:表示同一时刻只能只用一种codec,注意一个FID不要使用同一个port/ip。FID的实现场景:可以用于重传机制的实现

ssrc-id:有多个,表示一个组里面的所有ssrc

参考自:https://tools.ietf.org/html/rfc5576#section-4

备注:关于rtx的文档https://tools.ietf.org/html/rfc4588

1.4 rtpmap属性
 a=rtpmap:<payload type> <encoding name>/<clock rate> [/<encoding
         parameters>]
1
2
​ a=rtpmap:120 VP8/90000

payload type:有效载荷类型

encoding name:编码器

encoding parameters:如果是音频,可能表示的是通道数

(备注:有ulpfec和flexfec两种payload类型,参考文档为:

ulpfec:https://tools.ietf.org/html/rfc5109

flexfec:https://tools.ietf.org/html/draft-ietf-payload-flexible-fec-scheme-05)

参考自:https://tools.ietf.org/html/rfc4566

1.5 MediaContentDirection属性
a=sendrecv
a=recvonly
a=sendonly
a=inactive
1
2
3
4
参考自:https://tools.ietf.org/html/rfc4566

1.6 ice-ufrag 和 ice-pwd属性
a=ice-ufrag:<ufrag>
a=ice-pwd:<pwd>
1
2
​ a=ice-ufrag:ufrag_video

​ a=ice-pwd:pwd_video

ice打洞的用户名和密码

a=ice-ufrag:ufrag_video

a=ice-pwd:pwd_video

参考自:https://tools.ietf.org/html/rfc5245#section-15.4

1.7 candidate属性
a=candidate <foundation> <component-id> <transport> <priority> <connection-address> typ <candidate-types> <rel-addr> <rel-port>
1
​ a=candidate:a0+B/4 1 udp 2130706432 74.125.224.39 3457 typ relay generation 2

foundation:用来区别两个candidate是否是一样的类型,一样的base addr, 一样的 stun server

component-id:从1开始递增。RTP的必须是1,RTCP必须是2

priority:优先级,不知道怎么用

cand-type:有四种”host”, “srflx”, “prflx”, “relay”。srflx即server reflexive, prflx即peer reflexive,relay即relayed candidates。应该是四种连接方式。

rel-addr:目前的理解是stun或turn服务器地址

rel-port:

参考自:https://tools.ietf.org/html/rfc5245

1.8 rtcp属性
a=rtcp:<port> <nettype> <addrtype> <connection-address>
1
​ a=rtcp:2347 IN IP4 74.125.127.126

rtcp的属性信息

参考自:https://tools.ietf.org/id/draft-ietf-mmusic-sdp4nat-00.txt

1.9 msid-semantic属性
a=msid-semantic:<msid>
1
​ a=msid-semantic: WMS local_stream_1

WMS表示Webrtc Media Streams

local_stream_1表示msid(msid具体作用应该是和ssrc对应)

参考自:https://tools.ietf.org/html/draft-alvestrand-rtcweb-msid-02#section-3

1.10 msid属性
a=msid:<msid>
1
​ a=msid: local_stream_1

The value of the “msid” attribute consists of an identifier and an optional “appdata” field.(msid属性由标识符和appdata组成)

This new attribute allows endpoints to associate RTP streams that are described in different media descriptions with the same MediaStreams(msid属性允许端点和RTP流连接在不同的media descriptions中使用相同的MediaStreams)

and to carry an identifier for each MediaStreamTrack in its “appdata” field(appdata放置MediaStreamTrack)

参考自:https://tools.ietf.org/html/draft-ietf-mmusic-msid-16#page-10

备注:webrtc中SdpSerialize函数第二个参数需要设置为true才可以有该属性,如果直接用jsep的toString函数,就不会有这个属性

1.11 group属性
a=group:<semantics> <semantics-extension>
1
​ a=group:BUNDLE

“a=group” lines are used to group together several “m” lines that are identified by their “mid” attribute(group属性用于通过mid标识符把多个m属性连接起来)

There MAY be several “a=group” lines in a session description.The “a=group” lines of a session description can use the same or different semantics(group属性可以有多个,并且可以有相同或不同的语义)

参考自:

https://tools.ietf.org/html/rfc5888

https://tools.ietf.org/html/draft-ietf-mmusic-sdp-bundle-negotiation-39

1.12 bundle-only属性
a=bundle-only
1
​ a=bundle-only

和group属性结合使用。表示不同的media使用同一个port

1.13 rtcp-fb属性
a=rtcp-fb:<payload> <param>
1
​ a=rtcp-fb:96 ccm fir

参考自:https://tools.ietf.org/html/rfc4585

1.14 rtcp-rsize属性
a=rtcp-rsize
1
​ a=rtcp-rsize

参考自:https://tools.ietf.org/html/rfc5506

1.15 fingerprint属性
a=fingerprint:<hash-func> <fingerprint>
1
​ a=fingerprint:SHA-1 4A:AD:B9:B1:3F:82:18:3B:54:02:12:DF:3E:5D:49:6B:19:E5:7C:AB

参考自:https://tools.ietf.org/html/rfc4572#page-7

1.16 extmap属性
a=extmap:<id> <uri>
1
​ a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/video-timing

rtp的头部扩展。具有三个属性:

1.非对称(可以表示recvonly,sendonly)

2.可以有相互排斥的选择(answer可以选择offer提供相同id中的其中一个rtpextension,id须为4096~4351)

3.在一个会话中可以表示多个头部扩展

参考自:https://tools.ietf.org/html/rfc5285

1.17 fmtp属性
a=fmtp:<payload> <param>
1
​ a=fmtp:97 apt=96

表示codec对应的payloadtype,以及param

参考自:https://tools.ietf.org/html/rfc4566

1.18 mid属性
a=mid:<media name>
1
​ a=mid:audio

表示media的名字,用于查找具体的media

1.19 setup属性
a=setup:<role>
1
​ a=setup:active

表示连接中的角色,是主动连接,还是被动连接等

2 v字段
v=0

参考自:https://tools.ietf.org/html/rfc4566

3 o字段
​ o=(用户名)(会话标识)(版本)(网络类型)(地址类型)(地址)

​ o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1

参考自:https://tools.ietf.org/html/rfc4566

4 s字段
​ s=(会话名)

参考自:https://tools.ietf.org/html/rfc4566

5 m字段
​ m=(媒体)(端口)(传送层)(格式列表)

​ m=audio 2345 RTP/SAVPF 111 103 104

参考自:https://tools.ietf.org/html/rfc4566

6 b字段
传输速率

参考自:https://tools.ietf.org/html/rfc4566

offer/answer:
对于offer/answer,可以查看:

https://tools.ietf.org/html/rfc3264#page-8

注:

1.The answer MUST contain exactly the same number of “m=” lines as the offer(m属性的个数和offer的m属性个数要一致)

2.If the answerer has no media formats in common for a particular offered stream, the answerer MUST reject that media stream by setting the port to zero.(如果answer方没有和offer一样的media formats,那么就通过设置端口为0拒绝这个media stream)

3.answer拒绝:如果要拒绝掉一个media stream,那么就需要把拒绝的media的port设置为0,但是有一种情况要注意,就是a=bundle-only,在前面还有a=group:BUNDLE字段,表示几个media stream公用一个端口,这个时候的media可以设置port为0

CreateAnswer比较codec
1.对于audio和video,都会比较两者的name是否一致,如果payload小于等于95,也会比较id是否一致(因为小于等于95的都是静态的payload)

2.对于audio,会比较两者的clockrate,bitrate,channels必须都一致,或者其中一个为0。

3.对于video,如果是H264,则会比较profile-level-id是否一致
--------------------- 
作者:ezLeo 
来源:CSDN 
原文:https://blog.csdn.net/myiloveuuu/article/details/78998183 
版权声明:本文为博主原创文章,转载请附上博文链接!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值