diff options
author | Timo Rothenpieler <timo@rothenpieler.org> | 2019-11-17 01:27:44 +0100 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2019-11-17 01:41:11 +0100 |
commit | 44fe41a1cae9bd05bfc76b2ac1e6add14f1dbebc (patch) | |
tree | 806e04e1b7b6ca7998f3c99bcc8762b636794102 | |
parent | 61853f7503530ae11ed407a80463dc7ac2e7362d (diff) | |
download | ffmpeg-44fe41a1cae9bd05bfc76b2ac1e6add14f1dbebc.tar.gz |
avcodec/nvenc: make sure newly allocated packets are refcounted
Fixes ticket 8383
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
-rw-r--r-- | libavcodec/nvenc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 316e4a3679..fb13dfc3a5 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1836,7 +1836,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; } |