了解 WebRTC 生成的 SDP

Understanding SDP generated by WebRTC

我去chrome://webrtc-internals/复制了sdp。总的来说,我想明白其中的意思。

setRemoteDescription

type: answer, sdp: v=0
o=mozilla...THIS_IS_SDPARTA-39.0 6618245136742574887 0 IN IP4 0.0.0.0
s=-
t=0 0
a=fingerprint:sha-256 27:8B:F6:1A:72:47:17:2B:23:C1:9A:85:AB:3A:E0:29:15:B9:F5:B0:B6:EA:17:C9:11:99:AA:B7:AB:45:A9:60
a=ice-options:trickle
a=msid-semantic:WMS *
m=application 9 DTLS/SCTP 5000
c=IN IP4 0.0.0.0
a=sendrecv
a=ice-pwd:a33017ce6eae687d1afdae61c9f0db55
a=ice-ufrag:f8acf035
a=mid:data
a=sctpmap:5000 webrtc-datachannel 256
a=setup:active

具体来说,我想了解

的意思
a=sctpmap:5000 webrtc-datachannel 256

sctpmap 属性的格式is defined as:

The sctpmap attribute maps from a port number (as used in an "m=" line) to an encoding name denoting the payload format to be used on top of the SCTP association or the actual protocol running on top of it.

The sctpmap MUST include the app parameter indicating the application running on top of the association.

The sctpmap line should also contain the max-message-size parameter indicating the maximum message size, in bytes, the endpoint is willing to accept.

所以行 a=sctpmap:5000 webrtc-datachannel 256 表示端口 5000,应用程序名称 'webrtc-datachannel' 和消息大小 256 字节。

这是在您生成的 SDP 中,因为您的应用程序正在使用 PeerConnection 上的数据通道。