[FFmpeg-cvslog] avcodec/nvdec: Push the context before destroying the decoder

Philip Langdale git at videolan.org
Wed Oct 24 20:45:17 EEST 2018


ffmpeg | branch: master | Philip Langdale <philipl at overt.org> | Wed Oct 24 10:39:13 2018 -0700| [2d0ee127be14f44df19790d3aab5b551319f4a62] | committer: Philip Langdale

avcodec/nvdec: Push the context before destroying the decoder

This has no visible effects but I happened to run under the cuda
memcheck tool and it called it out as an error.

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

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

diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index e779be3a45..4dd6b1acf3 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -149,8 +149,12 @@ static void nvdec_decoder_free(void *opaque, uint8_t *data)
 {
     NVDECDecoder *decoder = (NVDECDecoder*)data;
 
-    if (decoder->decoder)
+    if (decoder->decoder) {
+        CUcontext dummy;
+        decoder->cudl->cuCtxPushCurrent(decoder->cuda_ctx);
         decoder->cvdl->cuvidDestroyDecoder(decoder->decoder);
+        decoder->cudl->cuCtxPopCurrent(&dummy);
+    }
 
     av_buffer_unref(&decoder->hw_device_ref);
 



More information about the ffmpeg-cvslog mailing list