[FFmpeg-devel] [PATCH] oggdec: validate VP8 keyframes

Ronald S. Bultje rsbultje at gmail.com
Fri Jan 10 02:37:40 CET 2014


Hi,

On Thu, Jan 9, 2014 at 5:16 PM, James Almer <jamrial at gmail.com> wrote:

> Fixes seeking in files with broken files
>
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>  libavformat/oggdec.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
> index efb8f04..9200432 100644
> --- a/libavformat/oggdec.c
> +++ b/libavformat/oggdec.c
> @@ -722,8 +722,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-");
>

Isn't this duplicate with vp8_parser.c, or in other words, shouldn't we
invoke the AVParser if it exists?

Ronald


More information about the ffmpeg-devel mailing list