mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-13 01:38:20 +00:00
[host] fix crash on screen blanking
This commit is contained in:
parent
14954cc426
commit
8a9d0b0bfb
@ -614,7 +614,7 @@ GrabStatus Capture::DXGI::GrabFrameTexture(struct FrameInfo & frame, struct Curs
|
||||
return GRAB_STATUS_OK;
|
||||
}
|
||||
|
||||
if (!SUCCEEDED(status))
|
||||
if (FAILED(status))
|
||||
break;
|
||||
|
||||
m_releaseFrame = true;
|
||||
@ -657,7 +657,7 @@ GrabStatus Capture::DXGI::GrabFrameTexture(struct FrameInfo & frame, struct Curs
|
||||
|
||||
DXGI_OUTDUPL_POINTER_SHAPE_INFO shapeInfo;
|
||||
status = m_dup->GetFramePointerShape(m_pointerBufSize, m_pointer, &m_pointerSize, &shapeInfo);
|
||||
if (!SUCCEEDED(status))
|
||||
if (FAILED(status))
|
||||
{
|
||||
DEBUG_WINERROR("Failed to get the new pointer shape", status);
|
||||
return GRAB_STATUS_ERROR;
|
||||
@ -681,14 +681,19 @@ GrabStatus Capture::DXGI::GrabFrameTexture(struct FrameInfo & frame, struct Curs
|
||||
cursor.dataSize = m_pointerSize;
|
||||
}
|
||||
|
||||
// if we also have frame data
|
||||
// if we also have frame data, break out to process it
|
||||
if (frameInfo.LastPresentTime.QuadPart != 0)
|
||||
break;
|
||||
|
||||
// no frame data, clean up
|
||||
SafeRelease(&res);
|
||||
ReleaseFrame();
|
||||
|
||||
// if the cursor has been updated
|
||||
if (cursor.updated)
|
||||
return GRAB_STATUS_CURSOR;
|
||||
|
||||
// otherwise just try again
|
||||
}
|
||||
|
||||
if (SUCCEEDED(status))
|
||||
@ -762,12 +767,6 @@ GrabStatus Capture::DXGI::GrabFrameRaw(FrameInfo & frame, struct CursorInfo & cu
|
||||
while(true)
|
||||
{
|
||||
result = GrabFrameTexture(frame, cursor, src, timeout);
|
||||
if (result != GRAB_STATUS_OK)
|
||||
{
|
||||
ReleaseFrame();
|
||||
return result;
|
||||
}
|
||||
|
||||
if (timeout)
|
||||
{
|
||||
if (!m_surfaceMapped)
|
||||
@ -786,10 +785,6 @@ GrabStatus Capture::DXGI::GrabFrameRaw(FrameInfo & frame, struct CursorInfo & cu
|
||||
break;
|
||||
}
|
||||
|
||||
m_deviceContext->CopyResource(m_texture, src);
|
||||
SafeRelease(&src);
|
||||
|
||||
result = ReleaseFrame();
|
||||
if (result != GRAB_STATUS_OK)
|
||||
return result;
|
||||
|
||||
@ -799,6 +794,13 @@ GrabStatus Capture::DXGI::GrabFrameRaw(FrameInfo & frame, struct CursorInfo & cu
|
||||
m_surfaceMapped = false;
|
||||
}
|
||||
|
||||
m_deviceContext->CopyResource(m_texture, src);
|
||||
SafeRelease(&src);
|
||||
|
||||
result = ReleaseFrame();
|
||||
if (result != GRAB_STATUS_OK)
|
||||
return result;
|
||||
|
||||
HRESULT status;
|
||||
status = m_deviceContext->Map(m_texture, 0, D3D11_MAP_READ, 0, &m_mapping);
|
||||
if (FAILED(status))
|
||||
|
@ -183,10 +183,8 @@ bool Service::Process()
|
||||
// wait for the host to notify that is it is ready to proceed
|
||||
while (true)
|
||||
{
|
||||
const uint8_t f = *flags;
|
||||
|
||||
// check if the client has flagged a restart
|
||||
if (f & KVMFR_HEADER_FLAG_RESTART)
|
||||
if (*flags & KVMFR_HEADER_FLAG_RESTART)
|
||||
{
|
||||
DEBUG_INFO("Restart Requested");
|
||||
if (!m_capture->ReInitialize())
|
||||
|
@ -115,8 +115,10 @@ int run(struct StartupArgs & args)
|
||||
return -1;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (!svc->Process())
|
||||
break;
|
||||
}
|
||||
|
||||
svc->DeInitialize();
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user