[FFmpeg-cvslog] rtsp: Retry authentication if failed due to being stale

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 13:59:53 2012 +0200| [2f96cc1fc41f2d3a349d55f9d2078694a6a87dc1] | committer: Martin Storsjö

rtsp: Retry authentication if failed due to being stale

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

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

 libavformat/rtsp.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 4290abb..ecc1cba 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1122,7 +1122,7 @@ int ff_rtsp_send_cmd_with_content(AVFormatContext *s,
 {
     RTSPState *rt = s->priv_data;
     HTTPAuthType cur_auth_type;
-    int ret;
+    int ret, attempts = 0;
 
 retry:
     cur_auth_type = rt->auth_state.auth_type;
@@ -1133,9 +1133,11 @@ retry:
 
     if ((ret = ff_rtsp_read_reply(s, reply, content_ptr, 0, method) ) < 0)
         return ret;
+    attempts++;
 
-    if (reply->status_code == 401 && cur_auth_type == HTTP_AUTH_NONE &&
-        rt->auth_state.auth_type != HTTP_AUTH_NONE)
+    if (reply->status_code == 401 &&
+        (cur_auth_type == HTTP_AUTH_NONE || rt->auth_state.stale) &&
+        rt->auth_state.auth_type != HTTP_AUTH_NONE && attempts < 2)
         goto retry;
 
     if (reply->status_code > 400){



More information about the ffmpeg-cvslog mailing list