💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
[TOC] ## 概述 设置会话的属性,以及传输模式,提醒S建立会话 ## 格式 请求与响应 | 头字段 | 描述 | | --- | --- | | Transport | 指出如何传输数据流。分别支持 RTP/AVP;unicast;client\_port=port1-port2 RTP/AVP;multicast;client\_port=port1-port2 RTP/AVP/TCP;unicast 等不同的传输方式 | 响应中必须包含 sessionid,如果如果添加了timemout,测在非保活的情形下,到时断开连接,可以使用OPTIONS 命令进行包活 **Transport **字段定义 ``` Transport = "Transport" ":"transport-spec transport-spec = transport-protocol/profile[/lower-transport];parameter transport-protocol = "RTP" profile = "AVP" lower-transport = "TCP" | "UDP" parameter = ( "unicast" | "multicast" ) | ";" "destination" [ "=" address ] | ";" "interleaved" "=" channel [ "-" channel ] | ";" "append" | ";" "ttl" "=" ttl | ";" "layers" "=" 1*DIGIT | ";" "port" "=" port [ "-" port ] | ";" "client_port" "=" port [ "-" port ] | ";" "server_port" "=" port [ "-" port ] | ";" "ssrc" "=" ssrc | ";" "mode" = <"> 1\#mode <"> ttl = 1*3(DIGIT) port = 1*5(DIGIT) ssrc = 8*8(HEX) channel = 1*3(DIGIT) address = host mode = <">Method <"> | Method ``` 示例 ``` Transport: RTP/AVP;multicast;ttl=127;mode="PLAY", Transport: RTP/AVP;unicast;client_port=3456-3457;mode="PLAY" ``` ## 示例 ### Transport 为 UDP 请求 ``` SETUP rtsp://192.17.1.63:554/trackID=1 RTSP/1.0 Transport: RTP/AVP/UDP;unicast;client_port=26968-26969 CSeq: 4 User-Agent: Lavf58.42.100 Authorization: Digest username="admin", realm="IP Camera(23306)", nonce="a946c352dd3ad04cf9830d5e72ffb11e", uri="rtsp://192.17.1.63:554/trackID=1", response="e29ca030062df6022faa77fefde40b28" ``` 响应 ``` RTSP/1.0 200 OK CSeq: 4 Session: 337474243;timeout=60 Transport: RTP/AVP/UDP;unicast;client_port=26968-26969;server_port=8284-8285;ssrc=4a7fb757;mode="play" Date: Fri, Apr 10 2020 19:07:19 GMT ``` - **TRANSPORT**表明媒体流的传输方式,具体包括传输协议如RTP/UDP;指出是单播,组播还是广播(如unicast表示单播);声明两个端口,一个奇数,用于接收RTCP数据,一个偶数,用于接收RTP数据; ### Transport 为 TCP (interleaved 模式) 则可以沿用建立的连线的连线,不用指定端口,而是在原來的TCP連線之下,改成使用 channel id 來辨別封包內容為 RTP 或 RTCP ``` SETUP rtsp://video.foocorp.com:554/streams/example.rm RTSP/1.0 Cseq: 3 Transport: rtp/avp/tcp; interleaved=0-1 ``` 接下来的数据包头部第二个字节位置就是interleaved,0表示rtp包,1表示rtcp包,接受端根据interleaved的值来区别是哪种数据包