if (avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)
decode_postinit(h, 1);
- ff_h264_field_end(h, &h->slice_ctx[0], 0);
+ if ((ret = ff_h264_field_end(h, &h->slice_ctx[0], 0)) < 0)
+ return ret;
/* Wait for second field. */
*got_frame = 0;
}
if (avctx->hwaccel) {
- if (avctx->hwaccel->end_frame(avctx) < 0)
+ err = avctx->hwaccel->end_frame(avctx);
+ if (err < 0)
av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");
}
if (h->current_slice) {
av_assert0(!h->setup_finished);
if (h->cur_pic_ptr && FIELD_PICTURE(h) && h->first_field) {
- ff_h264_field_end(h, h->slice_ctx, 1);
+ ret = ff_h264_field_end(h, h->slice_ctx, 1);
h->current_slice = 0;
+ if (ret < 0)
+ return ret;
} else if (h->cur_pic_ptr && !FIELD_PICTURE(h) && !h->first_field && h->nal_unit_type == NAL_IDR_SLICE) {
av_log(h, AV_LOG_WARNING, "Broken frame packetizing\n");
- ff_h264_field_end(h, h->slice_ctx, 1);
+ ret = ff_h264_field_end(h, h->slice_ctx, 1);
h->current_slice = 0;
ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 0);
ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 1);
h->cur_pic_ptr = NULL;
+ if (ret < 0)
+ return ret;
} else
return AVERROR_INVALIDDATA;
}
return ret;
if (avctx->hwaccel) {
- if (s->ref && avctx->hwaccel->end_frame(avctx) < 0)
+ if (s->ref && (ret = avctx->hwaccel->end_frame(avctx)) < 0) {
av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");
+ ff_hevc_unref_frame(s, s->ref, ~0);
+ return ret;
+ }
} else {
/* verify the SEI checksum */
if (avctx->err_recognition & AV_EF_CRCCHECK && s->is_decoded &&
if (s->avctx->hwaccel &&
(s->avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD)) {
- if (s->avctx->hwaccel->end_frame(s->avctx) < 0)
+ if ((ret = s->avctx->hwaccel->end_frame(s->avctx)) < 0) {
av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode first field\n");
+ return ret;
+ }
}
for (i = 0; i < 4; i++) {
return 0;
if (s->avctx->hwaccel) {
- if (s->avctx->hwaccel->end_frame(s->avctx) < 0)
+ int ret = s->avctx->hwaccel->end_frame(s->avctx);
+ if (ret < 0) {
av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");
+ return ret;
+ }
}
/* end of slice reached */