Keeping Alive Rtsp Connection

20,049

What is the value of timeout you receive in SETUP response? Are you using this value for implementing keep alive functionality?

Session = "Session" ":" session-id [ ";" "timeout" "=" delta-seconds ]

Generally RTSP is based on TCP and RTP is based on UDP. So ideally both the channels require keep alive functionality. If RTP session is closed that does not mean that RTSP connection should also be teardown whereas RTP channels must be closed on RTSP channel teardown.

1) What is the best way to keep alive connection with RTSP server? --> Send any RTSP request periodically (OPTIONS, SET_PARAMETER or GET_PARAMETER) before timeout value received in SETUP response.

2) Do i have to implement RTCP [ send RTCP packets to server]? May the connection drop because i do not send RTCP packets to server? --> RFC (RTSP or RTP) does not mandate requirement of RTCP to keep RTP channels alive.

Share:
20,049

Related videos on Youtube

Novalis
Author by

Novalis

It is just me:-)

Updated on October 10, 2020

Comments

  • Novalis
    Novalis over 3 years

    I have a simple Rtsp Client...The client send Rtsp Commands to Rtsp Server and get RTP packets from server.

    The problem is that after a time( about 3-4 minute) my 3rd party RTSP Server drop connection with my RTSP Client.

    I have not implemented RTCP...I take rtp packets from rtsp server but does not send any RTCP PACKET...

    I make simple search and find that some guys use some RTSP commands[ like OPTIONS, SET PARAMETER-GET PARAMETER ] too keep alive Connections between RTSP Server and Client... But in my case that does not work...

    Here is my questions:

    1. What is the best way to keep alive connection with RTSP server?
    2. Do i have to implement RTCP [ send RTCP packets to server]? May the connection drop because i do not send RTCP packets to server?
  • Novalis
    Novalis over 12 years
    My 3rd party rtsp server does not give session time out value...Although i send OPTIONS command at every 5 seconds it drops connection...
  • Alam
    Alam over 12 years
    It means your server is expecting RTCP packets.
  • Novalis
    Novalis over 12 years
    Yes...When i send RTCP packets it does not drop connnections...But it "eats" an axtra bandwidth..
  • Alam
    Alam over 12 years
    Cost of sending RTCP is minimal. RTCP should take only 5% of your total bandwidth. As you are concerned about bandwidth then sending RTCP is more important for you. Based on RTCP packets server can dynamically control bandwidth based on network load. RTCP can be used for calculating packet loss and jitter in the network. So RTCP is important for maintaining the quality of the system.
  • Dany
    Dany over 11 years
    @Alam Sir i have the same case but problem is that my client connect to server through port 2222 and start receiving the rtsp stream from server now how will i send the RTSP request periodically (OPTIONS, SET_PARAMETER or GET_PARAMETER) before timeout value received in SETUP response on the same port while i will be receiving the stream data,
  • Alam
    Alam over 11 years
    Your question is not very much clear to me... RTSP is a TCP connection. Use the same FD you used to connect with server on port 2222. RTP uses UDP which is different from RTSP channel. Keep alive message should be sent on RTSP channel not RTP channel
  • Gediminas
    Gediminas almost 7 years
    Note that "GET_PARAMETER" is not supported by all RTSP servers. Before sending it, you should check response to "OPTIONS" if it contains "GET_PARAMETER" parameter.