Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

fix memory leaks in the d3d11 renderer #729

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions talk/owt/sdk/base/win/videorendererd3d11.cc
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,7 @@ void WebrtcVideoRendererD3D11Impl::RenderI420Frame_DX11(
{
webrtc::MutexLock lock(&d3d11_texture_lock_);
if (d3d11_texture_) {
d3d11_texture_->Release();
d3d11_texture_ = nullptr;
d3d11_texture_.Release();
}
}

Expand Down Expand Up @@ -737,8 +736,7 @@ bool WebrtcVideoRendererD3D11Impl::CreateStagingTexture(int width, int height) {
d3d11_staging_texture_->GetDesc(&desc);
if (desc.Width != (unsigned int)width ||
desc.Height != (unsigned int)height) {
d3d11_staging_texture_->Release();
d3d11_staging_texture_ = nullptr;
d3d11_staging_texture_.Release();
} else
return true;
}
Expand Down
18 changes: 9 additions & 9 deletions talk/owt/sdk/base/win/videorendererd3d11.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ class WebrtcVideoRendererD3D11Impl
int window_height_ = 0;

// D3D11 objects
ID3D10Multithread* p_mt = nullptr;
ID3D11Device* d3d11_device_ = nullptr;
ID3D11Device2* d3d11_device2_ = nullptr;
ID3D11VideoDevice* d3d11_video_device_ = nullptr;
ID3D11DeviceContext* d3d11_device_context_ = nullptr;
ID3D11VideoContext* d3d11_video_context_ = nullptr;
ID3D11DeviceContext1* dx11_device_context1_ = nullptr;
CComPtr<ID3D10Multithread> p_mt;
CComPtr<ID3D11Device> d3d11_device_;
CComPtr<ID3D11Device2> d3d11_device2_;
CComPtr<ID3D11VideoDevice> d3d11_video_device_;
CComPtr<ID3D11DeviceContext> d3d11_device_context_;
CComPtr<ID3D11VideoContext> d3d11_video_context_;
CComPtr<ID3D11DeviceContext1> dx11_device_context1_;

CComPtr<IDXGIFactory2> dxgi_factory_;
CComPtr<IDXGISwapChain1> swap_chain_for_hwnd_;
Expand All @@ -86,8 +86,8 @@ class WebrtcVideoRendererD3D11Impl

// Handle of texture holding decoded image.
webrtc::Mutex d3d11_texture_lock_;
ID3D11Texture2D* d3d11_texture_ = nullptr;
ID3D11Texture2D* d3d11_staging_texture_ = nullptr;
CComPtr<ID3D11Texture2D> d3d11_texture_;
CComPtr<ID3D11Texture2D> d3d11_staging_texture_;
D3D11_TEXTURE2D_DESC d3d11_texture_desc_;
// Local view is using normal d3d11 swapchain.
bool d3d11_raw_inited_ = false;
Expand Down