From 4d8a9e2e1d7d257aeff0497b6550df82f60bc0e8 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 28 Feb 2024 18:11:39 +0100 Subject: Pool size 20 for vaapi --- src/capture/kms_cuda.c | 2 -- src/capture/kms_vaapi.c | 2 +- src/capture/nvfbc.c | 13 ------------- src/capture/xcomposite_cuda.c | 2 -- src/capture/xcomposite_vaapi.c | 2 +- 5 files changed, 2 insertions(+), 19 deletions(-) (limited to 'src/capture') diff --git a/src/capture/kms_cuda.c b/src/capture/kms_cuda.c index 9ef25f8..8970a0b 100644 --- a/src/capture/kms_cuda.c +++ b/src/capture/kms_cuda.c @@ -103,8 +103,6 @@ static bool cuda_create_codec_context(gsr_capture_kms_cuda *cap_kms, AVCodecCont hw_frame_context->device_ref = device_ctx; hw_frame_context->device_ctx = (AVHWDeviceContext*)device_ctx->data; - hw_frame_context->initial_pool_size = 1; - if (av_hwframe_ctx_init(frame_context) < 0) { fprintf(stderr, "Error: Failed to initialize hardware frame context " "(note: ffmpeg version needs to be > 4.0)\n"); diff --git a/src/capture/kms_vaapi.c b/src/capture/kms_vaapi.c index 18a8c2d..d3ab77c 100644 --- a/src/capture/kms_vaapi.c +++ b/src/capture/kms_vaapi.c @@ -85,7 +85,7 @@ static bool drm_create_codec_context(gsr_capture_kms_vaapi *cap_kms, AVCodecCont hw_frame_context->device_ref = device_ctx; hw_frame_context->device_ctx = (AVHWDeviceContext*)device_ctx->data; - hw_frame_context->initial_pool_size = 1; // TODO: (and in other places) + hw_frame_context->initial_pool_size = 20; AVVAAPIDeviceContext *vactx =((AVHWDeviceContext*)device_ctx->data)->hwctx; cap_kms->va_dpy = vactx->display; diff --git a/src/capture/nvfbc.c b/src/capture/nvfbc.c index 5eab5d3..4d9c9ff 100644 --- a/src/capture/nvfbc.c +++ b/src/capture/nvfbc.c @@ -130,16 +130,6 @@ static bool gsr_capture_nvfbc_load_library(gsr_capture *cap) { return true; } -#if LIBAVUTIL_VERSION_MAJOR < 57 -static AVBufferRef* dummy_hw_frame_init(int size) { - return av_buffer_alloc(size); -} -#else -static AVBufferRef* dummy_hw_frame_init(size_t size) { - return av_buffer_alloc(size); -} -#endif - static bool ffmpeg_create_cuda_contexts(gsr_capture_nvfbc *cap_nvfbc, AVCodecContext *video_codec_context) { AVBufferRef *device_ctx = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_CUDA); if(!device_ctx) { @@ -171,9 +161,6 @@ static bool ffmpeg_create_cuda_contexts(gsr_capture_nvfbc *cap_nvfbc, AVCodecCon hw_frame_context->device_ref = device_ctx; hw_frame_context->device_ctx = (AVHWDeviceContext*)device_ctx->data; - hw_frame_context->pool = av_buffer_pool_init(1, dummy_hw_frame_init); - hw_frame_context->initial_pool_size = 1; - if (av_hwframe_ctx_init(frame_context) < 0) { fprintf(stderr, "gsr error: cuda_create_codec_context failed: failed to initialize hardware frame context " "(note: ffmpeg version needs to be > 4.0)\n"); diff --git a/src/capture/xcomposite_cuda.c b/src/capture/xcomposite_cuda.c index 8217805..557d333 100644 --- a/src/capture/xcomposite_cuda.c +++ b/src/capture/xcomposite_cuda.c @@ -119,8 +119,6 @@ static bool cuda_create_codec_context(gsr_capture_xcomposite_cuda *cap_xcomp, AV hw_frame_context->device_ref = device_ctx; hw_frame_context->device_ctx = (AVHWDeviceContext*)device_ctx->data; - hw_frame_context->initial_pool_size = 1; - if (av_hwframe_ctx_init(frame_context) < 0) { fprintf(stderr, "Error: Failed to initialize hardware frame context " "(note: ffmpeg version needs to be > 4.0)\n"); diff --git a/src/capture/xcomposite_vaapi.c b/src/capture/xcomposite_vaapi.c index 2775bb3..d32dd39 100644 --- a/src/capture/xcomposite_vaapi.c +++ b/src/capture/xcomposite_vaapi.c @@ -93,7 +93,7 @@ static bool drm_create_codec_context(gsr_capture_xcomposite_vaapi *cap_xcomp, AV hw_frame_context->device_ref = device_ctx; hw_frame_context->device_ctx = (AVHWDeviceContext*)device_ctx->data; - hw_frame_context->initial_pool_size = 1; + hw_frame_context->initial_pool_size = 20; AVVAAPIDeviceContext *vactx =((AVHWDeviceContext*)device_ctx->data)->hwctx; cap_xcomp->va_dpy = vactx->display; -- cgit v1.2.3