我正在实现简单的RTSP服务器,它应该通过rtsp流式传输mjpeg。当我回复一些响应数据时,我遇到的第一个问题是“挂起”RTSP客户端(我尝试过vlc和openRTSP):buffering issue with java communicating vlc
然而,很容易发现问题的根在请求结束时错过了双\ r \ n序列。我已经成功编写了OPTIONS和DESCRIBE的响应,这些响应在客户端上得到了正确处理。
我在尝试实现SETUP时遇到了问题。当我向SETUP输出一些格式正确的RTSP响应时,openRTSPvlc都不会将响应处理为完成:
openRTSP rtsp://localhost:6666/autostream.mjpg
Opening connection to 127.0.0.1, port 6666...
...remote connection opened
Sending request: OPTIONS rtsp://localhost:6666/autostream.mjpg RTSP/1.0
CSeq: 2
User-Agent: openRTSP (LIVE555 Streaming Media v2013.04.30)
Received 158 new bytes of response data.
Received a complete OPTIONS response:
RTSP/1.0 200 OK
CSeq: 2
Public: OPTIONS, PAUSE, PLAY, SETUP, SET_PARAMETER, TEARDOWN
Server: GStreamer RTSP server
Date: Tue, 10 Sep 2013 19:56:53 GMT
Sending request: DESCRIBE rtsp://localhost:6666/autostream.mjpg RTSP/1.0
CSeq: 3
User-Agent: openRTSP (LIVE555 Streaming Media v2013.04.30)
Accept: application/sdp
Received 484 new bytes of response data.
Received a complete DESCRIBE response:
RTSP/1.0 200 OK
CSeq: 3
Content-Type: application/sdp
Content-Base: rtsp://localhost:6666/autostream.mjpeg/
Server: GStreamer RTSP server
Date: Tue, 10 Sep 2013 19:56:53 GMT
Content-Length: 279
v=0
o=- 1188340656180883 1 IN IP4 127.0.0.1
s=Session streamed with GStreamer
i=rtsp-server
e=NONE
t=0 0
a=tool:GStreamer
a=type:broadcast
a=control:*
a=range:npt=0,000000-119,961667
m=video 0 RTP/AVP 96
c=IN IP4 127.0.0.1
a=rtpmap:96 JPEG/90000
a=control:stream=0
(plus 2 additional bytes)
Opened URL "rtsp://localhost:6666/autostream.mjpg", returning a SDP description:
v=0
o=- 1188340656180883 1 IN IP4 127.0.0.1
s=Session streamed with GStreamer
i=rtsp-server
e=NONE
t=0 0
a=tool:GStreamer
a=type:broadcast
a=control:*
a=range:npt=0,000000-119,961667
m=video 0 RTP/AVP 96
c=IN IP4 127.0.0.1
a=rtpmap:96 JPEG/90000
a=control:stream=0
Created receiver for "video/JPEG" subsession (client ports 57074-57075)
Sending request: SETUP rtsp://localhost:6666/autostream.mjpeg/stream=0 RTSP/1.0
CSeq: 4
User-Agent: openRTSP (LIVE555 Streaming Media v2013.04.30)
Transport: RTP/AVP;unicast;client_port=57074-57075
Received 215 new bytes of response data.
在那条消息之后没有任何反应。我假设,幕后的RTP和RTCP会发生一些事情,但调试的方式是什么? VLC和openRTSP输出的详细信息不够详细。
有什么想法吗?
答案 0 :(得分:0)
与往常一样,向stackoverflow发布愚蠢的问题有助于我自己找出问题(看起来像一种墨菲定律;我必须在3小时前发布它以节省我的睡眠!)
关键词是
(plus 2 additional bytes)
(openRTSP)
(plus 2 additional bytes)
[0x7f73900013f8] live555 demux debug: RTP subsession 'video/JPEG'
(VLC)
我已经对DESCRIBE的响应中的第二个/ r / n进行了硬编码,尽管它具有响应的消息体。对于那些空体的响应,应该有双/ r / n。