You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/fic: Postpone duplicating AVFrame buffer
This avoids duplicating the AVFrames in case of skip frames or in case of errors. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -282,9 +282,6 @@ static int fic_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
|||||||
int skip_cursor = ctx->skip_cursor;
|
int skip_cursor = ctx->skip_cursor;
|
||||||
const uint8_t *sdata;
|
const uint8_t *sdata;
|
||||||
|
|
||||||
if ((ret = ff_reget_buffer(avctx, ctx->frame, 0)) < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
/* Header + at least one slice (4) */
|
/* Header + at least one slice (4) */
|
||||||
if (avpkt->size < FIC_HEADER_SIZE + 4) {
|
if (avpkt->size < FIC_HEADER_SIZE + 4) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Frame data is too small.\n");
|
av_log(avctx, AV_LOG_ERROR, "Frame data is too small.\n");
|
||||||
@ -407,6 +404,9 @@ static int fic_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
|||||||
ctx->slice_data[slice].y_off = y_off;
|
ctx->slice_data[slice].y_off = y_off;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((ret = ff_reget_buffer(avctx, ctx->frame, 0)) < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
if ((ret = avctx->execute(avctx, fic_decode_slice, ctx->slice_data,
|
if ((ret = avctx->execute(avctx, fic_decode_slice, ctx->slice_data,
|
||||||
NULL, nslices, sizeof(ctx->slice_data[0]))) < 0)
|
NULL, nslices, sizeof(ctx->slice_data[0]))) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
Reference in New Issue
Block a user