diff --git a/VERSION b/VERSION index 26002c68..333eff73 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -B1-169-g7018a3e737+1 \ No newline at end of file +B1-170-g75bc038144+1 \ No newline at end of file diff --git a/c-host/platform/Windows/capture/DXGI/src/dxgi.c b/c-host/platform/Windows/capture/DXGI/src/dxgi.c index 3930348b..cec8e3db 100644 --- a/c-host/platform/Windows/capture/DXGI/src/dxgi.c +++ b/c-host/platform/Windows/capture/DXGI/src/dxgi.c @@ -644,6 +644,25 @@ static unsigned int dxgi_getMaxFrameSize() return this->height * this->pitch; } +static CaptureResult dxgi_hResultToCaptureResult(const HRESULT status) +{ + switch(status) + { + case S_OK: + return CAPTURE_RESULT_OK; + + case DXGI_ERROR_WAIT_TIMEOUT: + return CAPTURE_RESULT_TIMEOUT; + + case WAIT_ABANDONED: + case DXGI_ERROR_ACCESS_LOST: + return CAPTURE_RESULT_REINIT; + + default: + return CAPTURE_RESULT_ERROR; + } +} + static CaptureResult dxgi_capture() { assert(this); @@ -669,24 +688,16 @@ static CaptureResult dxgi_capture() else status = IDXGIOutputDuplication_AcquireNextFrame(this->dup, 1000, &frameInfo, &res); - switch(status) + result = dxgi_hResultToCaptureResult(status); + if (result != CAPTURE_RESULT_OK) { - case S_OK: - this->needsRelease = true; - break; - - case DXGI_ERROR_WAIT_TIMEOUT: - return CAPTURE_RESULT_TIMEOUT; - - case WAIT_ABANDONED: - case DXGI_ERROR_ACCESS_LOST: - return CAPTURE_RESULT_REINIT; - - default: + if (result == CAPTURE_RESULT_ERROR) DEBUG_WINERROR("AcquireNextFrame failed", status); - return CAPTURE_RESULT_ERROR; + return result; } + this->needsRelease = true; + if (frameInfo.LastPresentTime.QuadPart != 0) { tex = &this->texture[this->texWIndex]; @@ -768,10 +779,12 @@ static CaptureResult dxgi_capture() DXGI_OUTDUPL_POINTER_SHAPE_INFO shapeInfo; LOCKED({status = IDXGIOutputDuplication_GetFramePointerShape(this->dup, bufferSize, pointerShape, &pointerShapeSize, &shapeInfo);}); - if (FAILED(status)) + result = dxgi_hResultToCaptureResult(status); + if (result != CAPTURE_RESULT_OK) { - DEBUG_WINERROR("Failed to get the new pointer shape", status); - return CAPTURE_RESULT_ERROR; + if (result == CAPTURE_RESULT_ERROR) + DEBUG_WINERROR("Failed to get the new pointer shape", status); + return result; } switch(shapeInfo.Type)