You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
avfilter/overlay_cuda: hold explicit reference to hw_device_ctx
This commit is contained in:
@@ -63,6 +63,7 @@ typedef struct OverlayCUDAContext {
|
|||||||
enum AVPixelFormat in_format_overlay;
|
enum AVPixelFormat in_format_overlay;
|
||||||
enum AVPixelFormat in_format_main;
|
enum AVPixelFormat in_format_main;
|
||||||
|
|
||||||
|
AVBufferRef *hw_device_ctx;
|
||||||
AVCUDADeviceContext *hwctx;
|
AVCUDADeviceContext *hwctx;
|
||||||
|
|
||||||
CUcontext cu_ctx;
|
CUcontext cu_ctx;
|
||||||
@@ -256,6 +257,9 @@ static av_cold void overlay_cuda_uninit(AVFilterContext *avctx)
|
|||||||
CHECK_CU(cu->cuModuleUnload(ctx->cu_module));
|
CHECK_CU(cu->cuModuleUnload(ctx->cu_module));
|
||||||
CHECK_CU(cu->cuCtxPopCurrent(&dummy));
|
CHECK_CU(cu->cuCtxPopCurrent(&dummy));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
av_buffer_unref(&ctx->hw_device_ctx);
|
||||||
|
ctx->hwctx = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -341,7 +345,9 @@ static int overlay_cuda_config_output(AVFilterLink *outlink)
|
|||||||
|
|
||||||
// initialize
|
// initialize
|
||||||
|
|
||||||
ctx->hwctx = frames_ctx->device_ctx->hwctx;
|
ctx->hw_device_ctx = av_buffer_ref(frames_ctx->device_ref);
|
||||||
|
ctx->hwctx = ((AVHWDeviceContext*)ctx->hw_device_ctx->data)->hwctx;
|
||||||
|
|
||||||
cuda_ctx = ctx->hwctx->cuda_ctx;
|
cuda_ctx = ctx->hwctx->cuda_ctx;
|
||||||
ctx->fs.time_base = inlink->time_base;
|
ctx->fs.time_base = inlink->time_base;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user