On 17/06/14 09:31, Martin Storsjö wrote: > On Tue, 17 Jun 2014, Luca Barbato wrote: > >> From: Joshua Kordani <[email protected]> >> >> Issue present in Avigilon IP cameras. >> --- >> libavformat/rtsp.c | 15 +++++++++++++-- >> 1 file changed, 13 insertions(+), 2 deletions(-) >> >> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c >> index adea3c6..c5a9d51 100644 >> --- a/libavformat/rtsp.c >> +++ b/libavformat/rtsp.c >> @@ -292,6 +292,9 @@ typedef struct SDPParseState { >> struct RTSPSource **default_include_source_addrs; /**< >> Source-specific multicast include source IP address (from SDP content) */ >> int nb_default_exclude_source_addrs; /**< Number of >> source-specific multicast exclude source IP address (from SDP content) */ >> struct RTSPSource **default_exclude_source_addrs; /**< >> Source-specific multicast exclude source IP address (from SDP content) */ >> + int seen_rtpmap; >> + int seen_fmtp; >> + char delayed_a_line[2048]; >> } SDPParseState; >> >> static void copy_default_source_addrs(struct RTSPSource **addrs, int >> count, >> @@ -504,13 +507,21 @@ static void sdp_parse_line(AVFormatContext *s, >> SDPParseState *s1, >> st = s->streams[rtsp_st->stream_index]; >> sdp_parse_rtpmap(s, st, rtsp_st, payload_type, p); >> } >> + s1->seen_rtpmap = 1; >> + if (s1->seen_fmtp) { >> + parse_fmtp(s, rt, payload_type, s1->delayed_a_line); >> + } >> } else if (av_strstart(p, "fmtp:", &p) || >> av_strstart(p, "framesize:", &p)) { >> - /* NOTE: fmtp is only supported AFTER the 'a=rtpmap:xxx' >> tag */ >> // let dynamic protocol handlers have a stab at the line. >> get_word(buf1, sizeof(buf1), &p); >> payload_type = atoi(buf1); >> - parse_fmtp(s, rt, payload_type, buf); >> + if (s1->seen_rtpmap) { >> + parse_fmtp(s, rt, payload_type, buf); >> + } else { >> + s1->seen_fmtp = 1; >> + strncpy(s1->delayed_a_line, buf, >> sizeof(s1->delayed_a_line)); > > I'd rather use av_strlcpy here, because strncpy doesn't do null > terminatin in case the buffer isn't large enough. >
Agreed. > Also, I think we should clear the seen_fmtp and seen_rtpmap variables at > some point (in the 'm' case perhaps?), otherwise this will mess things > up for sure in the case of multiple streams. Yes. Let see if it is enough. lu _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
