Keeping Alive Rtsp Connection

吃可爱长大的小学妹 提交于 2019-12-09 11:59:44

问题


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?

回答1:


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.




回答2:


Sending an OPTIONS request didn't work for me.

The only RTSP command that I could send to keep the connection alive was GET_PARAMETER

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

Works like a charm!

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



来源:https://stackoverflow.com/questions/7722467/keeping-alive-rtsp-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!