From b09ad37c83841c399abb7f2503a2ab214d0c2d48 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 20 Oct 2015 19:04:57 +0200 Subject: h264: derive the delay from the level when it's not present Fall back to maximum DPB size if the level is unknown. This should be more spec-compliant and does not depend on the caller setting has_b_frames before opening the decoder. The old behaviour, when the delay is supplied by the caller setting has_b_frames, can still be obtained by setting strict_std_compliance below normal. --- libavcodec/h264.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'libavcodec/h264.c') diff --git a/libavcodec/h264.c b/libavcodec/h264.c index ec57d6d2f7..6b12b303d7 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -851,18 +851,11 @@ static void decode_postinit(H264Context *h, int setup_finished) // FIXME do something with unavailable reference frames /* Sort B-frames into display order */ - - if (h->sps.bitstream_restriction_flag && - h->avctx->has_b_frames < h->sps.num_reorder_frames) { - h->avctx->has_b_frames = h->sps.num_reorder_frames; - h->low_delay = 0; - } - - if (h->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT && - !h->sps.bitstream_restriction_flag) { - h->avctx->has_b_frames = MAX_DELAYED_PIC_COUNT - 1; - h->low_delay = 0; + if (h->sps.bitstream_restriction_flag || + h->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL) { + h->avctx->has_b_frames = FFMAX(h->avctx->has_b_frames, h->sps.num_reorder_frames); } + h->low_delay = !h->avctx->has_b_frames; pics = 0; while (h->delayed_pic[pics]) -- cgit v1.2.3