aboutsummaryrefslogtreecommitdiff
path: root/src/capture/nvfbc.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-12-01 00:47:30 +0100
committerdec05eba <dec05eba@protonmail.com>2022-12-20 15:32:42 +0100
commit4e6fc174fe02d3ddb0d3dfe5894a31502df9b1ed (patch)
tree033dca81f26edf5f662406b902ca6fe6e2fd4f5e /src/capture/nvfbc.c
parent6a6bb703bce2d844175950ede4bda5d06dc5a8ae (diff)
follow focused
Diffstat (limited to 'src/capture/nvfbc.c')
-rw-r--r--src/capture/nvfbc.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/capture/nvfbc.c b/src/capture/nvfbc.c
index 17aedf8..ff3f9b7 100644
--- a/src/capture/nvfbc.c
+++ b/src/capture/nvfbc.c
@@ -344,8 +344,11 @@ static int gsr_capture_nvfbc_start(gsr_capture *cap, AVCodecContext *video_codec
cap_nvfbc->fbc_handle_created = false;
}
- av_buffer_unref(&video_codec_context->hw_device_ctx);
- av_buffer_unref(&video_codec_context->hw_frames_ctx);
+ if(video_codec_context->hw_device_ctx)
+ av_buffer_unref(&video_codec_context->hw_device_ctx);
+ // Not needed because the above call to unref device ctx also frees this?
+ //if(video_codec_context->hw_frames_ctx)
+ // av_buffer_unref(&video_codec_context->hw_frames_ctx);
gsr_cuda_unload(&cap_nvfbc->cuda);
return -1;
}
@@ -413,8 +416,11 @@ static int gsr_capture_nvfbc_capture(gsr_capture *cap, AVFrame *frame) {
static void gsr_capture_nvfbc_destroy(gsr_capture *cap, AVCodecContext *video_codec_context) {
gsr_capture_nvfbc *cap_nvfbc = cap->priv;
gsr_capture_nvfbc_destroy_session(cap);
- av_buffer_unref(&video_codec_context->hw_device_ctx);
- av_buffer_unref(&video_codec_context->hw_frames_ctx);
+ if(video_codec_context->hw_device_ctx)
+ av_buffer_unref(&video_codec_context->hw_device_ctx);
+ // Not needed because the above call to unref device ctx also frees this?
+ //if(video_codec_context->hw_frames_ctx)
+ // av_buffer_unref(&video_codec_context->hw_frames_ctx);
if(cap_nvfbc) {
gsr_cuda_unload(&cap_nvfbc->cuda);
dlclose(cap_nvfbc->library);