mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2025-02-04 02:56:24 +00:00
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>
This commit is contained in:
parent
bd8d73ea8b
commit
313a6c65b7
@ -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 *ogg = s->priv_data;
|
||||||
struct ogg_stream *os = ogg->streams + idx;
|
struct ogg_stream *os = ogg->streams + idx;
|
||||||
if (psize && s->streams[idx]->codec->codec_id == AV_CODEC_ID_THEORA) {
|
int invalid = 0;
|
||||||
if (!!(os->pflags & AV_PKT_FLAG_KEY) != !(os->buf[pstart] & 0x40)) {
|
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;
|
os->pflags ^= AV_PKT_FLAG_KEY;
|
||||||
av_log(s, AV_LOG_WARNING, "Broken file, %skeyframe not correctly marked.\n",
|
av_log(s, AV_LOG_WARNING, "Broken file, %skeyframe not correctly marked.\n",
|
||||||
(os->pflags & AV_PKT_FLAG_KEY) ? "" : "non-");
|
(os->pflags & AV_PKT_FLAG_KEY) ? "" : "non-");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user