avcodec/nvdec: Push the context before destroying the decoder
authorPhilip Langdale <philipl@overt.org>
Wed, 24 Oct 2018 17:39:13 +0000 (10:39 -0700)
committerPhilip Langdale <philipl@overt.org>
Wed, 24 Oct 2018 17:43:41 +0000 (10:43 -0700)
This has no visible effects but I happened to run under the cuda
memcheck tool and it called it out as an error.

libavcodec/nvdec.c

index e779be3..4dd6b1a 100644 (file)
@@ -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);