[Live-devel] rtsp and keeping alive connection with rtcp packets

Anthony Champagne anthony.champagne at haxe.fr
Thu Jun 5 02:01:03 PDT 2008


>>I've experienced the same problem with RTP/UDP.
>>My problem is that the live555 library takes IP address of the RTCP 
>>packet destination in the SDP description (RTSP proto).
>>My camera doesn't give this address in the c= field (if I remember 
>>well), it fills it with 0.0.0.0, so the library send RTCP packet to 
>>0.0.0.0 and it doesn't work.

>0.0.0.0 in the SDP "c=" line (in the RTSP "DESCRIBE" response) is 
>usually used only for unicast streaming. In this case, other RTSP 
>messages ("SETUP") are used to specify the server address (to which 
>the client should send RTCP packets).

>Once again (as I noted with the previous questioner) please try using 
>"openRTSP" as the client, and send us the diagnostic output, so we 
>can hopefully figure out what might be going wrong.

The openRTSP output follow (see below).

>>There's a method to force RTCP packet destination otherwise.
>>To solve the problem I'm using RTP over TCP and it doesn't need RTCP 
>>packets anymore.

>Yes, but we should also figure out why RTP/UDP streaming doesn't 
>work, and try to fix that.

I've modified a part of the RTSPClient::setupMediaSubsession() with a big
HACK in order to get the "real" peer address and it works well (RTSP with
RTP/UDP unicast and RTP over TCP). If it can help you a way or another.

------------------
if (streamUsingTCP) {
[...]
} else {
  // Normal case.
  // Set the RTP and RTCP sockets' destination address and port
  // from the information in the SETUP response: 
  if (subsession.connectionEndpointAddress()==0) 
  {
    sockaddr_in sain; int sainlen = sizeof(sockaddr_in);
    getpeername(fOutputSocketNum, (sockaddr*)&sain, &sainlen);
    delete[] subsession.connectionEndpointName();
    subsession.connectionEndpointName() = strdup(inet_ntoa(sain.sin_addr));
  }
  subsession.setDestinations(subsession.connectionEndpointAddress());
}
------------------

openRTSP output (on MS Windows):

D:\[...]\live\testProgs>openrtsp rtsp://192.168.2.106
Sending request: OPTIONS rtsp://192.168.2.106 RTSP/1.0
CSeq: 1
User-Agent: openrtsp (LIVE555 Streaming Media v2008.05.12)


Received OPTIONS response: RTSP/1.0 200 OK
CSeq: 1
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE


Sending request: DESCRIBE rtsp://192.168.2.106 RTSP/1.0
CSeq: 2
Accept: application/sdp
User-Agent: openrtsp (LIVE555 Streaming Media v2008.05.12)


Received DESCRIBE response: RTSP/1.0 200 OK
CSeq: 2
Content-Base: rtsp://192.168.2.106/
Content-Type: application/sdp
Content-Length: 251


Need to read 251 extra bytes
Read 251 extra bytes: v=0
o=- 1 1 IN IP4 127.0.0.1
s=Test
a=type:broadcast
t=0 0
c=IN IP4 0.0.0.0
m=video 0 RTP/AVP 96
a=rtpmap:96 MP4V-ES/90000
a=fmtp:96
profile-level-id=245;config=000001B0F5000001B509000001000000012000C888B0E0E0
FA62D089028307
a=control:track0

Opened URL "rtsp://192.168.2.106", returning a SDP description:
v=0
o=- 1 1 IN IP4 127.0.0.1
s=Test
a=type:broadcast
t=0 0
c=IN IP4 0.0.0.0
m=video 0 RTP/AVP 96
a=rtpmap:96 MP4V-ES/90000
a=fmtp:96
profile-level-id=245;config=000001B0F5000001B509000001000000012000C888B0E0E0
FA62D089028307
a=control:track0

Created receiver for "video/MP4V-ES" subsession (client ports 1120-1121)
Sending request: SETUP rtsp://192.168.2.106/track0 RTSP/1.0
CSeq: 3
Transport: RTP/AVP;unicast;client_port=1120-1121
User-Agent: openrtsp (LIVE555 Streaming Media v2008.05.12)


Received SETUP response: RTSP/1.0 200 OK
CSeq: 3
Transport: RTP/AVP;unicast;client_port=1120-1121;server_port=55982-55983
Session: 302AFD375E53B7FAA371E96185B463


Setup "video/MP4V-ES" subsession (client ports 1120-1121)
Created output file: "video-MP4V-ES-1"
Sending request: PLAY rtsp://192.168.2.106/ RTSP/1.0
CSeq: 4
Session: 302AFD375E53B7FAA371E96185B463
Range: npt=0.000-0.000
User-Agent: openrtsp (LIVE555 Streaming Media v2008.05.12)


Received PLAY response: RTSP/1.0 200 OK
CSeq: 4
Session: 302AFD375E53B7FAA371E96185B463


Started playing session
Receiving streamed data...
[...]







More information about the live-devel mailing list