[FFmpeg-cvslog] rtsp: Resend new keepalive commands if they used stale auth

Martin Storsjö git at videolan.org
Wed Mar 14 03:54:16 CET 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Mon Mar 12 16:11:22 2012 +0200| [cdf9108b6ae35f597f3a7932b70be7c8cf9bd743] | committer: Martin Storsjö

rtsp: Resend new keepalive commands if they used stale auth

These commands are sent asynchronously, not waiting for the reply.
This reply is parsed later by ff_rtsp_tcp_read_packet or
udp_read_packet. If the reply indicates that we used stale
authentication and need to use a new nonce, resend a new keepalive
command immediately.

This is the only request sent asynchronously, so currently there's
no other command that needs to be resent in the same way.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cdf9108b6ae35f597f3a7932b70be7c8cf9bd743
---

 libavformat/rtspdec.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index 80420aa..acae436 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -335,7 +335,8 @@ retry:
     rt->packets++;
 
     /* send dummy request to keep TCP connection alive */
-    if ((av_gettime() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2) {
+    if ((av_gettime() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2 ||
+         rt->auth_state.stale) {
         if (rt->server_type == RTSP_SERVER_WMS ||
            (rt->server_type != RTSP_SERVER_REAL &&
             rt->get_parameter_supported)) {
@@ -343,6 +344,10 @@ retry:
         } else {
             ff_rtsp_send_cmd_async(s, "OPTIONS", "*", NULL);
         }
+        /* The stale flag should be reset when creating the auth response in
+         * ff_rtsp_send_cmd_async, but reset it here just in case we never
+         * called the auth code (if we didn't have any credentials set). */
+        rt->auth_state.stale = 0;
     }
 
     return 0;



More information about the ffmpeg-cvslog mailing list