X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fdnxhd_parser.c;h=4ba619c9bb9d82d20dffa053deed2fbb491119c3;hb=1c7f252783aec37e4ff8049476386f63afe91756;hp=7c16e251a493785cc549126c39ddca5ba95d6c6e;hpb=493240a522fca34882601fbeeda4e17aa40a0303;p=ffmpeg diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c index 7c16e251a49..4ba619c9bb9 100644 --- a/libavcodec/dnxhd_parser.c +++ b/libavcodec/dnxhd_parser.c @@ -79,10 +79,9 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx, if (remaining <= 0) continue; } + remaining += i - 47; dctx->remaining = remaining; - if (buf_size - i + 47 >= dctx->remaining) { - int remaining = dctx->remaining; - + if (buf_size >= dctx->remaining) { pc->frame_start_found = 0; pc->state64 = -1; dctx->cur_byte = 0; @@ -90,6 +89,10 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx, return remaining; } else { dctx->remaining -= buf_size; + // Update variables for correctness, they are currently not used beyond here + state = -1; + dctx->cur_byte += buf_size - i; + break; } } } @@ -135,7 +138,7 @@ static int dnxhd_parse(AVCodecParserContext *s, return next; } -AVCodecParser ff_dnxhd_parser = { +const AVCodecParser ff_dnxhd_parser = { .codec_ids = { AV_CODEC_ID_DNXHD }, .priv_data_size = sizeof(DNXHDParserContext), .parser_parse = dnxhd_parse,