X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fh264_parse.c;h=ac31f54e07e6ece49274c9bc24dde3a2469c13e6;hb=48b86dd8a6bf50a7d8ab0343a1535bc4b0b5b196;hp=34ffe3b1fea2acb27c902d3ea604aa07816b362f;hpb=f3881c04e93ee70567bd3fe087f49b996b026d30;p=ffmpeg diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c index 34ffe3b1fea..ac31f54e07e 100644 --- a/libavcodec/h264_parse.c +++ b/libavcodec/h264_parse.c @@ -242,18 +242,23 @@ int ff_h264_parse_ref_count(int *plist_count, int ref_count[2], ref_count[1] = 1; } - if (ref_count[0] - 1 > max[0] || ref_count[1] - 1 > max[1]) { + if (slice_type_nos == AV_PICTURE_TYPE_B) + list_count = 2; + else + list_count = 1; + + if (ref_count[0] - 1 > max[0] || (list_count == 2 && (ref_count[1] - 1 > max[1]))) { av_log(logctx, AV_LOG_ERROR, "reference overflow %u > %u or %u > %u\n", ref_count[0] - 1, max[0], ref_count[1] - 1, max[1]); ref_count[0] = ref_count[1] = 0; *plist_count = 0; goto fail; + } else if (ref_count[1] - 1 > max[1]) { + av_log(logctx, AV_LOG_DEBUG, "reference overflow %u > %u \n", + ref_count[1] - 1, max[1]); + ref_count[1] = 0; } - if (slice_type_nos == AV_PICTURE_TYPE_B) - list_count = 2; - else - list_count = 1; } else { list_count = 0; ref_count[0] = ref_count[1] = 0; @@ -296,7 +301,8 @@ int ff_h264_init_poc(int pic_field_poc[2], int *pic_poc, if (picture_structure == PICT_FRAME) field_poc[1] += pc->delta_poc_bottom; } else if (sps->poc_type == 1) { - int abs_frame_num, expected_delta_per_poc_cycle, expectedpoc; + int abs_frame_num; + int64_t expected_delta_per_poc_cycle, expectedpoc; int i; if (sps->poc_cycle_length != 0) @@ -359,7 +365,7 @@ static int decode_extradata_ps(const uint8_t *data, int size, H264ParamSets *ps, H2645Packet pkt = { 0 }; int i, ret = 0; - ret = ff_h2645_packet_split(&pkt, data, size, logctx, is_avc, 2, AV_CODEC_ID_H264, 1); + ret = ff_h2645_packet_split(&pkt, data, size, logctx, is_avc, 2, AV_CODEC_ID_H264, 1, 0); if (ret < 0) { ret = 0; goto fail;