[FFmpeg-cvslog] avfilter/overlay_cuda: hold explicit reference to hw_device_ctx

2021-04-11 Thread Timo Rothenpieler
ffmpeg | branch: release/4.3 | Timo Rothenpieler  | Sat 
Apr 10 14:31:52 2021 +0200| [0fcaa9773943843c26ceb950ef2075d92f59bc21] | 
committer: Timo Rothenpieler

avfilter/overlay_cuda: hold explicit reference to hw_device_ctx

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

 libavfilter/vf_overlay_cuda.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_overlay_cuda.c b/libavfilter/vf_overlay_cuda.c
index f6ee43e929..e45f510644 100644
--- a/libavfilter/vf_overlay_cuda.c
+++ b/libavfilter/vf_overlay_cuda.c
@@ -63,6 +63,7 @@ typedef struct OverlayCUDAContext {
 enum AVPixelFormat in_format_overlay;
 enum AVPixelFormat in_format_main;
 
+AVBufferRef *hw_device_ctx;
 AVCUDADeviceContext *hwctx;
 
 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->cuCtxPopCurrent());
 }
+
+av_buffer_unref(>hw_device_ctx);
+ctx->hwctx = NULL;
 }
 
 /**
@@ -341,7 +345,9 @@ static int overlay_cuda_config_output(AVFilterLink *outlink)
 
 // 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;
 ctx->fs.time_base = inlink->time_base;
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avfilter/overlay_cuda: hold explicit reference to hw_device_ctx

2021-04-11 Thread Timo Rothenpieler
ffmpeg | branch: release/4.4 | Timo Rothenpieler  | Sat 
Apr 10 14:31:52 2021 +0200| [5873e06460856a8cb5da25a4f72e86e1d861c586] | 
committer: Timo Rothenpieler

avfilter/overlay_cuda: hold explicit reference to hw_device_ctx

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

 libavfilter/vf_overlay_cuda.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_overlay_cuda.c b/libavfilter/vf_overlay_cuda.c
index f6ee43e929..e45f510644 100644
--- a/libavfilter/vf_overlay_cuda.c
+++ b/libavfilter/vf_overlay_cuda.c
@@ -63,6 +63,7 @@ typedef struct OverlayCUDAContext {
 enum AVPixelFormat in_format_overlay;
 enum AVPixelFormat in_format_main;
 
+AVBufferRef *hw_device_ctx;
 AVCUDADeviceContext *hwctx;
 
 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->cuCtxPopCurrent());
 }
+
+av_buffer_unref(>hw_device_ctx);
+ctx->hwctx = NULL;
 }
 
 /**
@@ -341,7 +345,9 @@ static int overlay_cuda_config_output(AVFilterLink *outlink)
 
 // 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;
 ctx->fs.time_base = inlink->time_base;
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avfilter/overlay_cuda: hold explicit reference to hw_device_ctx

2021-04-11 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Sat Apr 
10 14:31:52 2021 +0200| [5d52c4cbba8daee4c6f752087c1a01ddc9c43eac] | committer: 
Timo Rothenpieler

avfilter/overlay_cuda: hold explicit reference to hw_device_ctx

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

 libavfilter/vf_overlay_cuda.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_overlay_cuda.c b/libavfilter/vf_overlay_cuda.c
index f6ee43e929..e45f510644 100644
--- a/libavfilter/vf_overlay_cuda.c
+++ b/libavfilter/vf_overlay_cuda.c
@@ -63,6 +63,7 @@ typedef struct OverlayCUDAContext {
 enum AVPixelFormat in_format_overlay;
 enum AVPixelFormat in_format_main;
 
+AVBufferRef *hw_device_ctx;
 AVCUDADeviceContext *hwctx;
 
 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->cuCtxPopCurrent());
 }
+
+av_buffer_unref(>hw_device_ctx);
+ctx->hwctx = NULL;
 }
 
 /**
@@ -341,7 +345,9 @@ static int overlay_cuda_config_output(AVFilterLink *outlink)
 
 // 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;
 ctx->fs.time_base = inlink->time_base;
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".