Skip to content
This repository has been archived by the owner on Jun 4, 2023. It is now read-only.

Commit

Permalink
avcodec/nvenc: also clear data pointer after unregistering a resource
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Rothenpieler <[email protected]>
  • Loading branch information
BtbN committed Jan 28, 2018
1 parent 48e52e4 commit 932037c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libavcodec/nvenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1540,6 +1540,7 @@ static int nvenc_find_free_reg_resource(AVCodecContext *avctx)
nv_status = p_nvenc->nvEncUnregisterResource(ctx->nvencoder, ctx->registered_frames[i].regptr);
if (nv_status != NV_ENC_SUCCESS)
return nvenc_print_error(avctx, nv_status, "Failed unregistering unused input resource");
ctx->registered_frames[i].ptr = NULL;
ctx->registered_frames[i].regptr = NULL;
}
return i;
Expand Down Expand Up @@ -1810,6 +1811,7 @@ static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSur
res = nvenc_print_error(avctx, nv_status, "Failed unregistering input resource");
goto error;
}
ctx->registered_frames[tmpoutsurf->reg_idx].ptr = NULL;
ctx->registered_frames[tmpoutsurf->reg_idx].regptr = NULL;
} else if (ctx->registered_frames[tmpoutsurf->reg_idx].mapped < 0) {
res = AVERROR_BUG;
Expand Down

0 comments on commit 932037c

Please sign in to comment.