summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Rothenpieler <[email protected]>2025-09-17 20:23:37 +0200
committerTimo Rothenpieler <[email protected]>2025-09-18 01:04:59 +0000
commit1849068c657c23e979e804cf90e63ae2f7381ec5 (patch)
tree84e61c531ae2a1ee500c82497aa17ff8cae1d7bd
parent4879c9f4e2f2afc269d305d941cf70d18f3883a8 (diff)
avfilter/vsrc_gfxcapture: use free threaded capture frame pool
Apparently, using a normal frame pool in a multithreaded environment leads to strange resource leaks on shutdown, which vanish when using a free threaded pool.
-rw-r--r--libavfilter/vsrc_gfxcapture_winrt.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavfilter/vsrc_gfxcapture_winrt.cpp b/libavfilter/vsrc_gfxcapture_winrt.cpp
index 47c3b2db88..62b1a94802 100644
--- a/libavfilter/vsrc_gfxcapture_winrt.cpp
+++ b/libavfilter/vsrc_gfxcapture_winrt.cpp
@@ -327,7 +327,7 @@ static int wgc_setup_gfxcapture_session(AVFilterContext *avctx)
std::unique_ptr<GfxCaptureContextWgc> &wgctx = ctx->wgc;
int ret;
- ComPtr<IDirect3D11CaptureFramePoolStatics> frame_pool_statics;
+ ComPtr<IDirect3D11CaptureFramePoolStatics2> frame_pool_statics;
ComPtr<ID3D11Device> d3d11_device = ctx->device_hwctx->device;
ComPtr<ID3D10Multithread> d3d10_multithread;
ComPtr<IDXGIDevice> dxgi_device;
@@ -350,8 +350,8 @@ static int wgc_setup_gfxcapture_session(AVFilterContext *avctx)
CHECK_HR_RET(d3d11_device.As(&dxgi_device));
CHECK_HR_RET(ctx->fn.CreateDirect3D11DeviceFromDXGIDevice(dxgi_device.Get(), &wgctx->d3d_device));
- CHECK_HR_RET(get_activation_factory<IDirect3D11CaptureFramePoolStatics>(ctx, RuntimeClass_Windows_Graphics_Capture_Direct3D11CaptureFramePool, &frame_pool_statics));
- CHECK_HR_RET(frame_pool_statics->Create(wgctx->d3d_device.Get(), fmt, CAPTURE_POOL_SIZE, wgctx->cap_size, &wgctx->frame_pool));
+ CHECK_HR_RET(get_activation_factory<IDirect3D11CaptureFramePoolStatics2>(ctx, RuntimeClass_Windows_Graphics_Capture_Direct3D11CaptureFramePool, &frame_pool_statics));
+ CHECK_HR_RET(frame_pool_statics->CreateFreeThreaded(wgctx->d3d_device.Get(), fmt, CAPTURE_POOL_SIZE, wgctx->cap_size, &wgctx->frame_pool));
CHECK_HR_RET(wgctx->frame_pool->CreateCaptureSession(wgctx->capture_item.Get(), &wgctx->capture_session));
if (SUCCEEDED(wgctx->capture_session.As(&session2))) {