@@ -637,7 +637,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
for (i = 0; i < h->pkt.nb_nals; i++) {
H2645NAL *nal = &h->pkt.nals[i];
- int max_slice_ctx, err;
+ int max_slice_ctx;
if (avctx->skip_frame >= AVDISCARD_NONREF &&
nal->ref_idc == 0 && nal->type != H264_NAL_SEI)
@@ -647,7 +647,6 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
h->nal_ref_idc = nal->ref_idc;
h->nal_unit_type = nal->type;
- err = 0;
switch (nal->type) {
case H264_NAL_IDR_SLICE:
if ((nal->data[1] & 0xFC) == 0x98) {
@@ -664,9 +663,13 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
case H264_NAL_SLICE:
h->has_slice = 1;
- if ((err = ff_h264_queue_decode_slice(h, nal))) {
+ ret = ff_h264_queue_decode_slice(h, nal);
+ if (ret < 0) {
H264SliceContext *sl = h->slice_ctx + h->nb_slice_ctx_queued;
sl->ref_count[0] = sl->ref_count[1] = 0;
+ av_log(h->avctx, AV_LOG_ERROR, "decode_slice_header error\n");
+ if (h->avctx->err_recognition & AV_EF_EXPLODE)
+ goto end;
break;
}
@@ -751,10 +754,6 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
av_log(avctx, AV_LOG_DEBUG, "Unknown NAL code: %d (%d bits)\n",
nal->type, nal->size_bits);
}
-
- if (err < 0) {
- av_log(h->avctx, AV_LOG_ERROR, "decode_slice_header error\n");
- }
}
ret = ff_h264_execute_decode_slices(h);
Signed-off-by: James Almer <jamrial@gmail.com> --- libavcodec/h264dec.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)