Skip to content

Commit 5d33a4d

Browse files
committed
avcodec/nvenc: make sure newly allocated packets are refcounted
Fixes ticket 8383. Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
1 parent eeab183 commit 5d33a4d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libavcodec/nvenc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1881,7 +1881,11 @@ static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSur
18811881
goto error;
18821882
}
18831883

1884-
if (res = ff_alloc_packet2(avctx, pkt, lock_params.bitstreamSizeInBytes,0)) {
1884+
res = pkt->data ?
1885+
ff_alloc_packet2(avctx, pkt, lock_params.bitstreamSizeInBytes, lock_params.bitstreamSizeInBytes) :
1886+
av_new_packet(pkt, lock_params.bitstreamSizeInBytes);
1887+
1888+
if (res < 0) {
18851889
p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, tmpoutsurf->output_surface);
18861890
goto error;
18871891
}

0 commit comments

Comments
 (0)