如何接收rtp数据

learntogether 2011-12-05 02:39:43
send length :79
OPTIONS rtsp://114.255.201.246/cctv2_256_h264.sdp?usernam RTSP/1.0
CSeq: 0

receive length :206
RTSP/1.0 200 OK
Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )
Cseq: 0
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD

send length :80
DESCRIBE rtsp://114.255.201.246/cctv2_256_h264.sdp?usernam RTSP/1.0
CSeq: 1

receive length :1162
RTSP/1.0 200 OK
Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )
Cseq: 1
Cache-Control: no-cache
Content-length: 756
Date: Mon, 05 Dec 2011 06:03:39 GMT
Expires: Mon, 05 Dec 2011 06:03:39 GMT
Content-Type: application/sdp
x-Accept-Retransmit: our-retransmit
x-Accept-Dynamic-Rate: 1
Content-Base: rtsp://114.255.201.246/cctv2_256_h264.sdp/

v=0
o=- 2411667325 3855649 IN IP4 172.30.0.5
s=HelixSession
c=IN IP4 0.0.0.0
t=0 0
a=control:*
m=video 0 RTP/AVP 96
b=AS:160
a=3GPP-Adaptation-Support:1
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=42E00B; sprop-parameter-sets=Z0LgC5ZUCg/I,aM48gA==; packetization-mode=1
a=framesize:96 320-240
a=cliprect:0,0,240,320
a=mpeg4-esid:201
a=X-initpredecbufperiod:90000
a=X-predecbufsize:20000
a=X-initpostdecbufperiod:0
a=X-decbyterate:20000
a=x-envivio-verid:00035A34
a=control:trackID=1
m=audio 0 RTP/AVP 97
b=AS:48
a=3GPP-Adaptation-Support:1
a=rtpmap:97 MP4A-LATM/32000/2
a=fmtp:97 profile-level-id=15; object=2; cpresent=0; config=420025203FC0; SBR-enabled=0
a=mpeg4-esid:101
a=x-envivio-verid:00035A34
a=control:trackID=2
send length :131
SETUP rtsp://114.255.201.246/cctv2_256_h264.sdp/trackID=1 RTSP/1.0
CSeq: 2
Transport: RTP/AVP;unicast;client_port=62400-62401

receive length :357
RTSP/1.0 200 OK
Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )
Cseq: 2
Cache-Control: no-cache
Session: 5703179625585050450
Date: Mon, 05 Dec 2011 06:03:39 GMT
Expires: Mon, 05 Dec 2011 06:03:39 GMT
Transport: RTP/AVP;unicast;source=10.199.99.26;client_port=62400-62401;server_port=6970-6971

send length :99
PLAY rtsp://114.255.201.246/cctv2_256_h264.sdp/ RTSP/1.0
CSeq: 4
Session: 5703179625585050450

receive length :245
RTSP/1.0 200 OK
Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )
Cseq: 4
Session: 5703179625585050450
Range: npt=now-
RTP-Info: url=rtsp://114.255.201.246/cctv2_256_h264.sdp/trackID=1


这是我对一个rtsp服务器的通信过程,请问接下来怎么接收rtp数据呢。我试了好多种方法,首先用TCP监听62400-62401端口,接收不到数据,用UDP监听也接收不到。连接服务器给的端口也连接不成功。
...全文
740 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
learntogether 2011-12-12
  • 打赏
  • 举报
回复
解决了 原因是rtp数据被防火墙屏蔽了
这样做就可以了

OPTIONS rtsp://114.255.201.246/cctv5_256_h264.sdp?usernam RTSP/1.0
CSeq: 1

RTSP/1.0 200 OK
Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )
Cseq: 1
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD

DESCRIBE rtsp://114.255.201.246/cctv5_256_h264.sdp?usernam RTSP/1.0
CSeq: 2

RTSP/1.0 200 OK
Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )
Cseq: 2
Cache-Control: no-cache
Content-length: 755
Date: Mon, 12 Dec 2011 09:46:21 GMT
Expires: Mon, 12 Dec 2011 09:46:21 GMT
Content-Type: application/sdp
x-Accept-Retransmit: our-retransmit
x-Accept-Dynamic-Rate: 1
Content-Base: rtsp://114.255.201.246/cctv5_256_h264.sdp/

v=0
o=- 291513024 3699575 IN IP4 172.30.0.7
s=HelixSession
c=IN IP4 0.0.0.0
t=0 0
a=control:*
m=video 0 RTP/AVP 96
b=AS:160
a=3GPP-Adaptation-Support:1
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=42E00B; sprop-parameter-sets=Z0LgC5ZUCg/I,aM48gA==; packetization-mode=1
a=framesize:96 320-240
a=cliprect:0,0,240,320
a=mpeg4-esid:201
a=X-initpredecbufperiod:90000
a=X-predecbufsize:20000
a=X-initpostdecbufperiod:0
a=X-decbyterate:20000
a=x-envivio-verid:00035A34
a=control:trackID=1
m=audio 0 RTP/AVP 97
b=AS:48
a=3GPP-Adaptation-Support:1
a=rtpmap:97 MP4A-LATM/32000/2
a=fmtp:97 profile-level-id=15; object=2; cpresent=0; config=420025203FC0; SBR-enabled=0
a=mpeg4-esid:101
a=x-envivio-verid:00035A34
a=control:trackID=2
SETUP rtsp://114.255.201.246/cctv5_256_h264.sdp/trackID=1 RTSP/1.0
CSeq: 3
Transport: RTP/AVP/TCP;interleaved=0-1

RTSP/1.0 200 OK
Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )
Cseq: 3
Cache-Control: no-cache
Session: 1053048633071767785
Date: Mon, 12 Dec 2011 09:46:21 GMT
Expires: Mon, 12 Dec 2011 09:46:21 GMT
Transport: RTP/AVP/TCP;interleaved=0-1

PLAY rtsp://114.255.201.246/cctv5_256_h264.sdp/ RTSP/1.0
CSeq: 4
Session: 1053048633071767785

RTSP/1.0 200 OK
Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )
Cseq: 4
Session: 1053048633071767785
Range: npt=now-
RTP-Info: url=rtsp://114.255.201.246/cctv5_256_h264.sdp/trackID=1


receive 1195 data.
receive 1440 data.
receive 4096 data.
receive 224 data.
receive 1440 data.
receive 1842 data.
receive 1850 data.
receive 1072 data.
receive 800 data.
receive 805 data.
receive 1771 data.
receive 834 data.
receive 839 data.
receive 1296 data.
receive 1302 data.
zoulie 2011-12-05
  • 打赏
  • 举报
回复
rtsp连接已经建立成功了
媒体流的地址是10.199.99.26,UDP传输
62400是rtp端口,62401是RTCP端口
qq120848369 2011-12-05
  • 打赏
  • 举报
回复
和http协议长得真像...

65,186

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧