Alive Rtsp Connection

I have a simple Rtsp client ... The client sends Rtsp commands to the Rtsp server and receives RTP packets from the server.

The problem is that after some time (about 3-4 minutes) my third-party RTSP shuts down the server with my RTSP client.

I did not implement RTCP ... I take rtp packets from the rtsp server, but it does not send RTCP PACKET ...

I do a simple search and find that some guys use some RTSP commands [for example, OPTIONS, SET PARAMETER-GET PARAMETER] also communicate between the RTSP server and the client ... But in my case it does not work ...

Here are my questions:

  • What is the best way to keep in touch with the RTSP server?
  • Do I need to perform RTCP [send RTCP packets to the server]? Can the connection fail because I do not send RTCP packets to the server?
+7
source share
2 answers

What is the timeout value that you get in the SETUP response? Do you use this value to implement supported functions?

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

Typically, RTSP is based on TCP and RTP is based on UDP. Therefore, ideally, both channels require the preservation of functionality. If the RTP session is closed, this does not mean that the RTSP connection should also be disconnected, while the RTP channels should be closed when the RTSP channel is broken.

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

2) Do I need to perform RTCP [send RTCP packets to the server]? Can the connection fail because I do not send RTCP packets to the server? → RFC (RTSP or RTP) does not require an RTCP requirement to support RTP channels.

+6
source

Sending an OPTIONS request did not help me.

The only RTSP command I could send to support the connection is GET_PARAMETER

My timeout is 60 s and I send a GET_PARAMETER request every 40 seconds

It works like a charm!

(No, you do not have RTCP packets on the server)

0
source

All Articles