Commit cb760a47 authored by Ronald S. Bultje's avatar Ronald S. Bultje

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
parent ce71d83e
...@@ -325,6 +325,7 @@ typedef struct SDPParseState { ...@@ -325,6 +325,7 @@ typedef struct SDPParseState {
/* SDP only */ /* SDP only */
struct in_addr default_ip; struct in_addr default_ip;
int default_ttl; int default_ttl;
int skip_media; ///< set if an unknown m= line occurs
} SDPParseState; } SDPParseState;
static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
...@@ -345,6 +346,8 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, ...@@ -345,6 +346,8 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
#endif #endif
p = buf; p = buf;
if (s1->skip_media && letter != 'm')
return;
switch(letter) { switch(letter) {
case 'c': case 'c':
get_word(buf1, sizeof(buf1), &p); get_word(buf1, sizeof(buf1), &p);
...@@ -383,12 +386,14 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, ...@@ -383,12 +386,14 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
break; break;
case 'm': case 'm':
/* new stream */ /* new stream */
s1->skip_media = 0;
get_word(st_type, sizeof(st_type), &p); get_word(st_type, sizeof(st_type), &p);
if (!strcmp(st_type, "audio")) { if (!strcmp(st_type, "audio")) {
codec_type = CODEC_TYPE_AUDIO; codec_type = CODEC_TYPE_AUDIO;
} else if (!strcmp(st_type, "video")) { } else if (!strcmp(st_type, "video")) {
codec_type = CODEC_TYPE_VIDEO; codec_type = CODEC_TYPE_VIDEO;
} else { } else {
s1->skip_media = 1;
return; return;
} }
rtsp_st = av_mallocz(sizeof(RTSPStream)); rtsp_st = av_mallocz(sizeof(RTSPStream));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment