I'm implementing simple RTSP server that should stream mjpeg over rtsp. The first problem I faced was the "hanging" RTSP client (i tried vlc and openRTSP) when I respond with some response data: buffering issue with java communicating vlc
However, that was easy to find out that the root of the problem was missed double \r\n sequence at the end of the request. I have successfully coded responses for OPTIONS and DESCRIBE, that are correctly handled on the client.
I faced with the problem when tried to implement SETUP. When I output some correctly formatted RTSP response to SETUP, both openRTSPvlc doesn't handle the response as complete:
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.
And nothing happens after that message. I assume, that something haappens with RTP and RTCP behind the scenes, but what is the way how debug it? VLC and openRTSP doesn't output detailed enough about it.
Any ideas?
As always, posting stupid questions to stackoverflow helps to find out the problem by myself (looks like a kind of Murphy law; I have to post it 3 hours ago to save my sleeping!)
The key word was
(plus 2 additional bytes)
(openRTSP)
(plus 2 additional bytes)
[0x7f73900013f8] live555 demux debug: RTP subsession 'video/JPEG'
(vlc)
I have hardcoded the second /r/n in the response to DESCRIBE despite of having message body of that responcs. There should be double /r/n for those response that has empty body.