summaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-09-19 18:22:31 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-09-19 18:34:55 +0200
commite3cf978cdda91df923e3e5d1f1e66133dbbe6218 (patch)
tree4327ea70b2a1fbfa68309ddfd1e6c56f1e2a8f6b /libavformat
parent0d097a869c38850c9ac09bccef60a229470f489b (diff)
downloadffmpeg-streaming-e3cf978cdda91df923e3e5d1f1e66133dbbe6218.zip
ffmpeg-streaming-e3cf978cdda91df923e3e5d1f1e66133dbbe6218.tar.gz
avformat/flvdec: Detect broken sizes (OBS 0.655b), disable resync for affected files
Fixes Ticket4867 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/flvdec.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 1221dab..16d25e9 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -58,6 +58,8 @@ typedef struct FLVContext {
int searched_for_end;
uint8_t resync_buffer[2*RESYNC_BUFFER_SIZE];
+
+ int broken_sizes;
} FLVContext;
static int probe(AVProbeData *p, int live)
@@ -516,6 +518,15 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream,
}
}
}
+ if (amf_type == AMF_DATA_TYPE_STRING) {
+ if (!strcmp(key, "encoder")) {
+ int version = -1;
+ if (1 == sscanf(str_val, "Open Broadcaster Software v0.%d", &version)) {
+ if (version > 0 && version <= 655)
+ flv->broken_sizes = 1;
+ }
+ }
+ }
}
if (amf_type == AMF_DATA_TYPE_OBJECT && s->nb_streams == 1 &&
@@ -1127,7 +1138,7 @@ retry_duration:
leave:
last = avio_rb32(s->pb);
- if (last != orig_size + 11) {
+ if (last != orig_size + 11 && !flv->broken_sizes) {
av_log(s, AV_LOG_ERROR, "Packet mismatch %d %d\n", last, orig_size + 11);
avio_seek(s->pb, pos + 1, SEEK_SET);
ret = resync(s);
OpenPOWER on IntegriCloud