diff mbox

[FFmpeg-devel] h264dec: h264_select_output_frame() - fill correctly has_b_frames based on the level

Message ID 20171109203836.11152-1-perex@perex.cz
State New
Headers show

Commit Message

Jaroslav Kysela Nov. 9, 2017, 8:38 p.m. UTC
The current code does not handle correctly the situation when sps->num_reoder_frames
was set using the level. The incorrect has_b_frames results in the wrong DTS guess and
malformed output (wrong 'Non-monotonous DTS' fixup).

sps->num_reorder_frames is set in the function ff_h264_decode_seq_parameter_set(),
see comment: 'if the maximum delay is not stored in the SPS, derive it based on the
level'.

Issue: #6810
---
 libavcodec/h264_slice.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 35dcabd611..04b10656e0 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1287,6 +1287,7 @@  static int h264_select_output_frame(H264Context *h)
     h->mmco_reset = 0;
 
     if (sps->bitstream_restriction_flag ||
+        sps->ref_frame_count ||
         h->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT) {
         h->avctx->has_b_frames = FFMAX(h->avctx->has_b_frames, sps->num_reorder_frames);
     }