[FFmpeg-cvslog] avcodec/nvenc: make sure newly allocated packets are refcounted

Timo Rothenpieler git at videolan.org
Sun Nov 17 02:46:28 EET 2019


ffmpeg | branch: release/4.2 | Timo Rothenpieler <timo at rothenpieler.org> | Sun Nov 17 01:27:44 2019 +0100| [44fe41a1cae9bd05bfc76b2ac1e6add14f1dbebc] | committer: Timo Rothenpieler

avcodec/nvenc: make sure newly allocated packets are refcounted

Fixes ticket 8383

Signed-off-by: Timo Rothenpieler <timo at rothenpieler.org>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=44fe41a1cae9bd05bfc76b2ac1e6add14f1dbebc
---

 libavcodec/nvenc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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;
     }



More information about the ffmpeg-cvslog mailing list