[FFmpeg-devel] [PATCH] rtsp.c: keep-alive

Matthew Naylor matthew.naylor
Thu Aug 12 04:14:42 CEST 2010


Ronald,

Yes, this is a really late response, but the code is still in
ffmpeg-dmo-0.6~svn20100726, so I feel justified in raising it.

Just wondering why you chose not to send the OPTIONS command to
RTSP_SERVER_RTP servers as well? RFC2326 states that OPTIONS
shall be supported by compliant servers, and that the default timeout for
the RTSP session shall be 60 seconds. So, I would expect all compliant
servers to stop after 60 seconds with the implementation as it stands.
As an example, I have an Axis P1311 camera that does just that. I
added RTSP_SERVER_RTP to your first if statement (in the snippet
below), so that it sends an "OPTIONS * RTSP/1.0\r\n" and it fixes the
issue in my case. However, others may know of cases where it won't
work.

Of course, that also raises the question about what to do with server
type RTSP_SERVER_NB. Would it be better to send OPTIONS
keep-alives by default, and only treat WMS, REAL, and any other
non-compliant servers as special cases?

I look forward to your feedback.

Matthew

On Sat, 7 Mar, 2009 Ronald S. Bultje wrote:
>Hi Luca,
>
>On Fri, Mar 6, 2009 at 4:21 PM, Luca Barbato <lu_zero at gentoo.org> wrote:
>> Ronald S. Bultje wrote:
>>> On Fri, Mar 6, 2009 at 1:32 PM, Luca Barbato <lu_zero at gentoo.org> wrote:
>>>> Shouldn't be enough sending rtcp RR as usual?
>>>
>>> RM doesn't use RTCP.
>>
>> Once you have it tested on wms and darwin (and feng if you like) you may
>> commit it then.
>
>MS doesn't like the OPTIONS and ignores it. MSDN [1] tells me to use
>an empty GET_PARAMETER, and that indeed appears to work in my tests
>(tried ~30min, worked fine). Attached patch works for WMS and Real
>servers.
>
>Feng / Darwin yet untested, any fancy test-sites you recommend for DSS?
>
>Ronald
>
>[1] http://msdn.microsoft.com/en-us/library/cc245366(PROT.10).aspx
>
>...
>+
>+    /* send dummy request to keep TCP connection alive */
>+    if ((rt->server_type == RTSP_SERVER_WMS ||

// I added this line to make  mine work:
         rt->server_type == RTSP_SERVER_RTP ||

>+         rt->server_type == RTSP_SERVER_REAL) &&
>+        (av_gettime() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2) {
>+        if (rt->server_type == RTSP_SERVER_WMS) {
>+            snprintf(cmd, sizeof(cmd) - 1,
>+                     "GET_PARAMETER %s RTSP/1.0\r\n",
>+                     s->filename);
>+            rtsp_send_cmd_async(s, cmd, reply, NULL);
>+        } else {
>+            rtsp_send_cmd_async(s, "OPTIONS * RTSP/1.0\r\n",
>+                                reply, NULL);
>+        }
>+    }
>+
>...



More information about the ffmpeg-devel mailing list