[FFmpeg-cvslog] avformat/flvdec: Use the first index entry to find the first packet if there was a parsing error in the header

Michael Niedermayer git at videolan.org
Sun Sep 13 14:24:23 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Sep 13 13:53:05 2015 +0200| [56291434335c56fd436646338e5088c2c90b81bb] | committer: Michael Niedermayer

avformat/flvdec: Use the first index entry to find the first packet if there was a parsing error in the header

Fixes: unknow_codec.flv

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=56291434335c56fd436646338e5088c2c90b81bb
---

 libavformat/flvdec.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 148c5be..826e0d7 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -854,6 +854,13 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
                 meta_pos = avio_tell(s->pb);
                 type = flv_read_metabody(s, next);
                 if (type == 0 && dts == 0 || type < 0 || type == TYPE_UNKNOWN) {
+                    if (type < 0 && flv->validate_count &&
+                        flv->validate_index[0].pos     > next &&
+                        flv->validate_index[0].pos - 4 < next
+                    ) {
+                        av_log(s, AV_LOG_WARNING, "Adjusting next position due to index mismatch\n");
+                        next = flv->validate_index[0].pos - 4;
+                    }
                     goto skip;
                 } else if (type == TYPE_ONTEXTDATA) {
                     avpriv_request_sample(s, "OnTextData packet");



More information about the ffmpeg-cvslog mailing list