[FFmpeg-cvslog] rtsp: Allow $ as interleaved packet indicator before a complete response header

Martin Storsjö git at videolan.org
Tue Oct 27 13:41:49 CET 2015


ffmpeg | branch: release/2.8 | Martin Storsjö <martin at martin.st> | Wed Oct 21 11:56:36 2015 +0300| [3f3e12c768124762afa52c9de51c1a9c2fd98720] | committer: Carl Eugen Hoyos

rtsp: Allow $ as interleaved packet indicator before a complete response header

Some RTSP servers ("HiIpcam/V100R003 VodServer/1.0.0") respond to
our keepalive GET_PARAMETER request by a truncated RTSP header
(lacking the final empty line to indicate a complete response
header). Prior to 764ec70149, this worked just fine since we
reacted to the $ as interleaved packet indicator anywhere.

Since $ is a valid character within the response header lines,
764ec70149 changed it to be ignored there. But to keep
compatibility with such broken servers, we need to at least
allow reacting to it at the start of lines.

Fixes ticket #4952.

Signed-off-by: Martin Storsjö <martin at martin.st>
(cherry picked from commit e02dcdf6bb6835ef4b49986b85a67efcb3495a7f)

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

 libavformat/rtsp.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 9aa66d2..3522783 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1136,7 +1136,6 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
     unsigned char ch;
     const char *p;
     int ret, content_length, line_count = 0, request = 0;
-    int first_line = 1;
     unsigned char *content = NULL;
 
 start:
@@ -1156,7 +1155,7 @@ start:
                 return AVERROR_EOF;
             if (ch == '\n')
                 break;
-            if (ch == '$' && first_line && q == buf) {
+            if (ch == '$' && q == buf) {
                 if (return_on_interleaved_data) {
                     return 1;
                 } else
@@ -1167,7 +1166,6 @@ start:
             }
         }
         *q = '\0';
-        first_line = 0;
 
         av_log(s, AV_LOG_TRACE, "line='%s'\n", buf);
 



More information about the ffmpeg-cvslog mailing list