diff options
author | James Almer <jamrial@gmail.com> | 2014-01-09 19:17:50 -0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-02-24 02:24:21 +0100 |
commit | 313a6c65b749d87a8735e4bd0f232488797827cb (patch) | |
tree | 08588668014878d8de6406aba1ca3b130d03234c /libavformat | |
parent | bd8d73ea8bb726de2506a292e00200d486fe24ca (diff) | |
download | ffmpeg-313a6c65b749d87a8735e4bd0f232488797827cb.tar.gz |
oggdec: validate VP8 keyframes
Fixes seeking with broken files
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/oggdec.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 66eb605b2f..fd18e99869 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -727,8 +727,16 @@ static void ogg_validate_keyframe(AVFormatContext *s, int idx, int pstart, int p { struct ogg *ogg = s->priv_data; struct ogg_stream *os = ogg->streams + idx; - if (psize && s->streams[idx]->codec->codec_id == AV_CODEC_ID_THEORA) { - if (!!(os->pflags & AV_PKT_FLAG_KEY) != !(os->buf[pstart] & 0x40)) { + int invalid = 0; + if (psize) { + switch (s->streams[idx]->codec->codec_id) { + case AV_CODEC_ID_THEORA: + invalid = !!(os->pflags & AV_PKT_FLAG_KEY) != !(os->buf[pstart] & 0x40); + break; + case AV_CODEC_ID_VP8: + invalid = !!(os->pflags & AV_PKT_FLAG_KEY) != !(os->buf[pstart] & 1); + } + if (invalid) { os->pflags ^= AV_PKT_FLAG_KEY; av_log(s, AV_LOG_WARNING, "Broken file, %skeyframe not correctly marked.\n", (os->pflags & AV_PKT_FLAG_KEY) ? "" : "non-"); |