]> git.sesse.net Git - ffmpeg/commitdiff
rtsp: Store the Content-Base header value straight to the target
authorMartin Storsjö <martin@martin.st>
Sun, 2 Jan 2011 10:11:12 +0000 (10:11 +0000)
committerMartin Storsjö <martin@martin.st>
Sun, 2 Jan 2011 10:11:12 +0000 (10:11 +0000)
This avoids having a large temporary buffer in the struct used for
storing the rtsp reply headers.

Originally committed as revision 26192 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/rtsp.c
libavformat/rtsp.h
libavformat/rtspdec.c

index 4ba5cefbfbc9f913c7f45fb06c73d98ffde050df..431703e205a0ce5227ccb5448584a008eedf425e 100644 (file)
@@ -724,9 +724,10 @@ void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf,
     } else if (av_stristart(p, "Authentication-Info:", &p) && rt) {
         p += strspn(p, SPACE_CHARS);
         ff_http_auth_handle_header(&rt->auth_state, "Authentication-Info", p);
-    } else if (av_stristart(p, "Content-Base:", &p)) {
+    } else if (av_stristart(p, "Content-Base:", &p) && rt) {
         p += strspn(p, SPACE_CHARS);
-        av_strlcpy(reply->content_base, p , sizeof(reply->content_base));
+        if (method && !strcmp(method, "DESCRIBE"))
+            av_strlcpy(rt->control_uri, p , sizeof(rt->control_uri));
     }
 }
 
index 2680297c294ad3caffee9163669c13cf91e828a2..628ce370ecb865e9ef7caf899cf31194daf57e13 100644 (file)
@@ -165,10 +165,6 @@ typedef struct RTSPMessageHeader {
      * returned
      */
     char reason[256];
-
-    /** The "Content-Base:" field.
-     */
-    char content_base[4096];
 } RTSPMessageHeader;
 
 /**
index 2ebc5156c76aaf0033099819dd3b4212c38fea82..13fa969dea85e697a631f6ba3de6d73d85b9de1d 100644 (file)
@@ -107,9 +107,6 @@ int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply)
         av_freep(&content);
         return AVERROR_INVALIDDATA;
     }
-    if (reply->content_base[0])
-        av_strlcpy(rt->control_uri, reply->content_base,
-                   sizeof(rt->control_uri));
 
     av_log(s, AV_LOG_VERBOSE, "SDP:\n%s\n", content);
     /* now we got the SDP description, we parse it */