Skip to content

Commit

Permalink
avcodec/nvenc: make sure newly allocated packets are refcounted
Browse files Browse the repository at this point in the history
Fixes ticket 8383.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
  • Loading branch information
BtbN committed Nov 17, 2019
1 parent eeab183 commit 5d33a4d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libavcodec/nvenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1881,7 +1881,11 @@ static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSur
goto error;
}

if (res = ff_alloc_packet2(avctx, pkt, lock_params.bitstreamSizeInBytes,0)) {
res = pkt->data ?
ff_alloc_packet2(avctx, pkt, lock_params.bitstreamSizeInBytes, lock_params.bitstreamSizeInBytes) :
av_new_packet(pkt, lock_params.bitstreamSizeInBytes);

if (res < 0) {
p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, tmpoutsurf->output_surface);
goto error;
}
Expand Down

0 comments on commit 5d33a4d

Please sign in to comment.