我正在实现简单的 RTSP 服务器,它应该通过 rtsp 流式传输 mjpeg。当我用一些响应数据进行响应时,我遇到的第一个问题是“挂起”的 RTSP 客户端(我尝试了 vlc 和 openRTSP):缓冲问题与 java 通信 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 没有输出足够详细的信息。
有任何想法吗?