--- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1460,6 +1460,11 @@ h->avctx->has_b_frames = sps->num_reorder_frames; } + if (sps && sps->bitstream_restriction_flag && + h->avctx->has_b_frames < sps->num_reorder_frames) { + h->avctx->has_b_frames = FFMAX(h->avctx->has_b_frames, sps->num_reorder_frames); + } + last_pic_droppable = h->droppable; last_pic_structure = h->picture_structure; h->droppable = (nal->ref_idc == 0);