国标GB28181 视音频流传输解读

视音频流传输模式
1 UDP
服务端开启UDP端口监听,通过INVITE信令通知设备端接收端口,设备端主动向服务端发起流推送

2 TCP被动(passive)
服务端开启TCP端口监听,通过INVITE信令通知设备端接收端口,设备端主动向服务端发起流推送

应用场景:设备端地址不确定,服务器端地址确定

3 TCP主动(active)
设备端通知服务器端监听的TCP端口信息,服务端主动连接设备端拉流,目前公安网都是这种模式

详细说明
a字段可携带setup、connection作为TCP连接协商参数,用于TCP方式传输媒体流服务端、客户端的协商,协商机制参考IETF RFC4571的定义。格式如下:

a=setup:TCP连接方式(表示本SDP发送者在RTP over TCP连接建立时是主动还是被动发起TCP连接,“active”为主动,“passive”为被动。)
 

5. Example
 The session descriptions in Figures 3 and 4 define a TCP RTP/AVP
 session.
 v=0
 o=first 2520644554 2838152170 IN IP4 first.example.net
 s=Example
 t=0 0
 c=IN IP4 192.0.2.105
 m=audio 9 TCP/RTP/AVP 11
 a=setup:active
 a=connection:new
 Figure 3: TCP session description for the first participant
 v=0
 o=second 2520644554 2838152170 IN IP4 second.example.net
 s=Example
 t=0 0
 c=IN IP4 192.0.2.94
 m=audio 16112 TCP/RTP/AVP 10 11
 a=setup:passive
 a=connection:new
 Figure 4: TCP session description for the second participant
 The session descriptions define two parties that participate in a
 connection-oriented RTP/AVP session. The first party (Figure 3) is
 capable of receiving stereo L16 streams (static payload type 11).

The second party (Figure 4) is capable of receiving mono (static
 payload type 10) or stereo L16 streams.
 The "setup" attribute in Figure 3 specifies that the first party is
 "active" and initiates connections, and the "setup" attribute in
 Figure 4 specifies that the second party is "passive" and accepts
 connections [COMEDIA].
 The first party connects to the network address (192.0.2.94) and port
 (16112) of the second party. Once the connection is established, it
 is used bi-directionally: the first party sends framed RTP packets to
 the second party in one direction of the connection, and the second
 party sends framed RTP packets to the first party in the other
 direction of the connection.
 The first party also initiates an RTCP TCP connection to port 16113
 (16112 + 1, as defined in [SDP]) of the second party. Once the
 connection is established, the first party sends framed RTCP packets
 to the second party in one direction of the connection, and the
 second party sends framed RTCP packets to the first party in the
 other direction of the connection.

视音频封装传输模式RTP over TCP
1前言

GB28181的TCP码流遵循的标准是RFC4571(RTP OVER TCP),具体类型是:

对比RTSP中的RTP over TCP
RTSP中tcp码流是遵循的RFC2326标准,

RTP,RTCP数据和RTSP数据共享TCP数据通道,所以必须有一个标识来区别三种数据:

RTP和RTCP数据会以$符号+1个字节的通道编号+2个字节的数据长度,共4个字节的前缀开始, RTSP数据是没有前缀数据的。 RTP数据和RTCP数据的区别在于第二个字节的通道编号 03

两个标准的区别

RFC4571标准格式: 长度(2字节) + RTP头+数据 RFC2326标准格式:$(1字节)+通道号(1字节)+长度(2字节) + RTP头+数据 提示

上面所说的长度,都是网络字节序。
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值