Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keeping Alive Rtsp Connection

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?
like image 369
Novalis Avatar asked Oct 11 '11 07:10

Novalis


People also ask

Do RTSP keep alive?

Generally RTSP is based on TCP and RTP is based on UDP. So ideally both the channels require keep alive functionality.

Is RTSP over UDP?

RTSP uses a Transmission Control Protocol (TCP) connection for control of the streaming media session, although it is also possible to use UDP for this purpose.

Why does RTSP use TCP?

RTMP is a TCP-based protocol which maintains persistent connections and allows low-latency communication. To deliver streams smoothly and transmit as much information as possible, it splits streams into fragments, and their size is negotiated dynamically between the client and server.

How do I start RTSP server?

To start the server, type systemctl start rtsp-server. To stop the server, type systemctl stop rtsp-server. To restart the server, type systemctl restart rtsp-server. The RTSP Server stores system log files, and names them using the following format: YYYYMMDD.


1 Answers

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.

like image 172
Alam Avatar answered Sep 19 '22 01:09

Alam