Is there such a RTSP Ping?

前端 未结 4 2007
小鲜肉
小鲜肉 2021-01-06 12:49

I am currently working on a WinForm app to stream videos from IP camera using the RTSP protocol in C#. Everything worked fine. Part of the requirement for the app includes a

4条回答
  •  猫巷女王i
    2021-01-06 13:24

    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

提交回复
热议问题