aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2009-01-24 04:56:18 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2009-01-24 04:56:18 +0000
commitcb760a4790c6d00b4ae44ad7b2c596850ac1cdb2 (patch)
treec798eef8a80146a859e677c8e464752c766698ce
parentce71d83edef1bbbcd26cb7a999dac1293da37565 (diff)
downloadffmpeg-cb760a4790c6d00b4ae44ad7b2c596850ac1cdb2.tar.gz
Skip m= blocks in the SDP if the media type is unknown. This prevents
subsequent a= lines from the m= block to be applied to the previous m= line, thus breaking otherwise functional RTP streams. See discussion in [PATCH] RTSP-MS 7/15: parse and allow unknown m= line codes" thread on mailinglist. Originally committed as revision 16737 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/rtsp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index f8aa3a0556..d6f87f7269 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -325,6 +325,7 @@ typedef struct SDPParseState {
/* SDP only */
struct in_addr default_ip;
int default_ttl;
+ int skip_media; ///< set if an unknown m= line occurs
} SDPParseState;
static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
@@ -345,6 +346,8 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
#endif
p = buf;
+ if (s1->skip_media && letter != 'm')
+ return;
switch(letter) {
case 'c':
get_word(buf1, sizeof(buf1), &p);
@@ -383,12 +386,14 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
break;
case 'm':
/* new stream */
+ s1->skip_media = 0;
get_word(st_type, sizeof(st_type), &p);
if (!strcmp(st_type, "audio")) {
codec_type = CODEC_TYPE_AUDIO;
} else if (!strcmp(st_type, "video")) {
codec_type = CODEC_TYPE_VIDEO;
} else {
+ s1->skip_media = 1;
return;
}
rtsp_st = av_mallocz(sizeof(RTSPStream));