Skip to content
Merged
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
3 changes: 2 additions & 1 deletion .github/workflows/push-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,9 @@ jobs:
PLATFORM: osx
USE_CCACHE: ${{ env.USE_CACHE }}
RESET_CACHE: ${{ env.RESET_CACHE }}
JOB_RUNNER: ${{ matrix.JOB_RUNNER }}
shell: bash
run: ./build.sh
run: ./build.sh || ( [ "$JOB_RUNNER" == "macos-13" ] && ./build.sh)

# Upload artifacts (only on tagged commit)
- name: Upload artifacts
Expand Down
9 changes: 8 additions & 1 deletion include/grabber/windows/DX/DxGrabber.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ template <class T> void SafeRelease(T** ppT)

struct DisplayHandle
{
static constexpr int WARNING_COUNT = 6;

QString name;
int warningCounter = 6;
int warningCounter = DisplayHandle::WARNING_COUNT;
bool wideGamut = false;
int actualDivide = -1, actualWidth = 0, actualHeight = 0;
uint targetMonitorNits = 0;
Expand Down Expand Up @@ -71,6 +73,11 @@ struct DisplayHandle
SafeRelease(&d3dDuplicate);
printf("SmartPointer is removing: DisplayHandle for %s\n", QSTRING_CSTR(name));
};

void resetStats()
{
warningCounter = DisplayHandle::WARNING_COUNT;
};
};

class DxGrabber : public Grabber
Expand Down
27 changes: 23 additions & 4 deletions sources/grabber/windows/DX/DxGrabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@ bool DxGrabber::start()
{
if (init())
{
for (auto&& display : _handles)
{
display->resetStats();
}

_timer->setInterval(1000 / _fps);
_timer->start();
Info(_log, "Started");
Expand Down Expand Up @@ -866,6 +871,11 @@ void DxGrabber::captureFrame(DisplayHandle& display)
if (_hardware)
{
status = deepScaledCopy(display, texDesktop);

if (!CHECK(status))
{
Error(_log, "DeepScaledCopy failed. Reason: %i", status);
}
}
else
{
Expand All @@ -886,13 +896,18 @@ void DxGrabber::captureFrame(DisplayHandle& display)
}
_d3dContext->Unmap(display.d3dSourceTexture, 0);
}
else
{
Error(_log, "Cannot copy or map texture. Reason: %i. Restarting...", status);
_dxRestartNow = true;
}

SafeRelease(&texDesktop);
}
else if (display.warningCounter > 0)
else
{
Error(_log, "ResourceDesktop->QueryInterface failed. Reason: %i", status);
display.warningCounter--;
_dxRestartNow = true;
}
}
else if (status == DXGI_ERROR_WAIT_TIMEOUT)
Expand All @@ -913,10 +928,14 @@ void DxGrabber::captureFrame(DisplayHandle& display)
Error(_log, "Lost DirectX capture context. Stopping.");
_dxRestartNow = true;
}
else if (display.warningCounter > 0)
else if (status == DXGI_ERROR_INVALID_CALL)
{
Error(_log, "DirectX invalid call. Stopping.");
_dxRestartNow = true;
}
else
{
Error(_log, "AcquireNextFrame failed. Reason: %i", status);
display.warningCounter--;
}

SafeRelease(&resourceDesktop);
Expand Down