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
@ -672,18 +672,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
GstFlowReturn
|
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;
|
ComPtr<ID3D11Texture2D> cur_texture;
|
||||||
resource.As (&cur_texture);
|
HRESULT hr;
|
||||||
|
resource->QueryInterface (IID_PPV_ARGS (&cur_texture));
|
||||||
if (!cur_texture) {
|
if (!cur_texture) {
|
||||||
GST_ERROR ("Couldn't get texture interface");
|
GST_ERROR ("Couldn't get texture interface");
|
||||||
return GST_FLOW_ERROR;
|
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 ();
|
dupl_->ReleaseFrame ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user