mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-27 15:34:49 +00:00
d3d12screencapturesrc: Always release acquired frame
AcquireNextFrame() call should be paired with ReleaseFrame(). Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7293>
This commit is contained in:
parent
9b6a3170ae
commit
c95873bbd5
1 changed files with 78 additions and 64 deletions
|
@ -672,18 +672,11 @@ public:
|
|||
}
|
||||
|
||||
GstFlowReturn
|
||||
Execute (ID3D11Texture2D * dest, D3D11_BOX * src_box, UINT64 fence_val)
|
||||
ExecuteInternal (IDXGIResource * resource)
|
||||
{
|
||||
ComPtr<IDXGIResource> resource;
|
||||
auto hr = dupl_->AcquireNextFrame(0, &frame_info_, &resource);
|
||||
if (hr != DXGI_ERROR_WAIT_TIMEOUT) {
|
||||
if (FAILED (hr)) {
|
||||
GST_WARNING ("AcquireNextFrame failed with 0x%x", (guint) hr);
|
||||
return flow_return_from_hr (device_.Get (), hr, FrameInfoExpectedErrors);
|
||||
}
|
||||
|
||||
ComPtr<ID3D11Texture2D> cur_texture;
|
||||
resource.As (&cur_texture);
|
||||
HRESULT hr;
|
||||
resource->QueryInterface (IID_PPV_ARGS (&cur_texture));
|
||||
if (!cur_texture) {
|
||||
GST_ERROR ("Couldn't get texture interface");
|
||||
return GST_FLOW_ERROR;
|
||||
|
@ -747,6 +740,27 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
GstFlowReturn
|
||||
Execute (ID3D11Texture2D * dest, D3D11_BOX * src_box, UINT64 fence_val)
|
||||
{
|
||||
ComPtr<IDXGIResource> resource;
|
||||
auto hr = dupl_->AcquireNextFrame(0, &frame_info_, &resource);
|
||||
if (hr != DXGI_ERROR_WAIT_TIMEOUT) {
|
||||
if (FAILED (hr)) {
|
||||
GST_WARNING ("AcquireNextFrame failed with 0x%x", (guint) hr);
|
||||
dupl_->ReleaseFrame ();
|
||||
return flow_return_from_hr (device_.Get (), hr, FrameInfoExpectedErrors);
|
||||
}
|
||||
|
||||
auto ret = ExecuteInternal(resource.Get ());
|
||||
dupl_->ReleaseFrame ();
|
||||
|
||||
if (ret != GST_FLOW_OK)
|
||||
return ret;
|
||||
} else {
|
||||
dupl_->ReleaseFrame ();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue