aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-18 23:26:37 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-18 23:27:01 +0200
commitdacc4cb11513543bdeeffef7944181418b70ce64 (patch)
tree314568d0f291db94807d0bd67eab7b24c227d5e9
parentbe94f5c171d95c2a4e926c59f9fd08e57b47edf9 (diff)
parentc385313d2590fd26e26bb9bdacddef78162ab490 (diff)
downloadffmpeg-dacc4cb11513543bdeeffef7944181418b70ce64.tar.gz
Merge commit 'c385313d2590fd26e26bb9bdacddef78162ab490'
* commit 'c385313d2590fd26e26bb9bdacddef78162ab490': rtsp: Support misordered fmtp rtpmap Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/rtsp.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 6c1095a094..8960a9a8ba 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -296,6 +296,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_fmtp[2048];
} SDPParseState;
static void copy_default_source_addrs(struct RTSPSource **addrs, int count,
@@ -385,7 +388,9 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
break;
case 'm':
/* new stream */
- s1->skip_media = 0;
+ s1->skip_media = 0;
+ s1->seen_fmtp = 0;
+ s1->seen_rtpmap = 0;
codec_type = AVMEDIA_TYPE_UNKNOWN;
get_word(st_type, sizeof(st_type), &p);
if (!strcmp(st_type, "audio")) {
@@ -508,13 +513,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_fmtp);
+ }
} 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;
+ av_strlcpy(s1->delayed_fmtp, buf, sizeof(s1->delayed_fmtp));
+ }
} else if (av_strstart(p, "range:", &p)) {
int64_t start, end;