Is there such a RTSP Ping?

邮差的信 提交于 2019-12-04 17:18:02
Jay

OPTIONS can possibly work but the standard specifies the correct way is through using theGET_PARAMETER.

RFC2326 outlines that clearly

http://www.ietf.org/rfc/rfc2326.txt

10.8 GET_PARAMETER

The GET_PARAMETER request retrieves the value of a parameter of a presentation or stream specified in the URI. The content of the reply and response is left to the implementation. GET_PARAMETER with no entity body may be used to test client or server liveness ("ping").

While GET_PARAMETER may not be supported by the server there is no way to tell how that server will react to the OPTIONS request which does not even require a sessionID. Therefor it cannot be guaranteed it will keep your existing session alive.

This is clear from reading the same RFC about the OPTIONS request

10.1 OPTIONS

The behavior is equivalent to that described in [H9.2]. An OPTIONS request may be issued at any time, e.g., if the client is about to try a nonstandard request. It does not influence server state.

Example:

 C->S:  OPTIONS * RTSP/1.0
        CSeq: 1
        Require: implicit-play
        Proxy-Require: gzipped-messages

 S->C:  RTSP/1.0 200 OK
        CSeq: 1
        Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE

Note that these are necessarily fictional features (one would hope that we would not purposefully overlook a truly useful feature just so that we could have a strong example in this section).

If GET_PARAMETER is not supported then you would issue a PLAY request with the SessionId of the session you want to keep alive.

This should work even if OPTIONS doesn't as PLAY honors the Session ID and if you are already playing there is no adverse effect.

For the C# RtspClient see my project @ https://net7mma.codeplex.com/

And the article on CodeProject @ http://www.codeproject.com/Articles/507218/Managed-Media-Aggregation-using-Rtsp-and-Rtp

iSamnium

Regarding RTSP in C# see this thread Using RTMP or RTSP protocol in C#

Regarding Ping ... you can implement is as DESCRIBE operation ... but pay attention do not make it too frequently, the device should be affected.

http://www.ietf.org/rfc/rfc2326.txt

Instead of ICMP ping, you might want to keep a helper RTSP session without video/audio RTP streams, checking good standing of socket connection and sending OPTIONS or DESCRIBE command on a regular basis, e.g. once a minute, in order to see if the device is responsive.

Some suggest using GET_PARAMETER instead of options, however this is inferior method. OPTIONS is mandatory, GET_PARAMETER is not. Both serve different purpose. Both have small server side execution expense. OPTIONS is clearly the better of the two.

Some servers may not support setting stream parameters and thus not support GET_PARAMETER and SET_PARAMETER.

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