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:37:34 +0100 |
commit | 4fb6ce27f0880599f0504ce4234b4de4fa87ad74 (patch) | |
tree | 5e651d089f5f94b6a21f24dca7ac8e736749658e /libavcodec/nvenc.c | |
parent | eeab18329f030bdcc2576eb6789cb5ed700eda33 (diff) | |
download | ffmpeg-4fb6ce27f0880599f0504ce4234b4de4fa87ad74.tar.gz |
avcodec/nvenc: make sure newly allocated packets are refcounted
Fixes ticket 8383
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Diffstat (limited to 'libavcodec/nvenc.c')
-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 111048d043..310e30805d 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -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; } |