Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.
C++
revert(capture): remove incomplete Qt frame gate
Veyra Goal Agent5073e4ad5b1c
diff --git a/apps/veyra-qml/main.cpp b/apps/veyra-qml/main.cppindex 3c017c4d..4f6462ff 100644--- a/apps/veyra-qml/main.cpp+++ b/apps/veyra-qml/main.cpp@@ -20,7 +20,6 @@#include <QQmlContext>#include <QQuickItem>#include <QQuickWindow>-#include "veyra/gfx/ObsQtFrameGate.h"#include <QSGRendererInterface>#include <QKeyEvent>#include <QTimer>@@ -757,18 +756,6 @@ static int runApplication(int argc, char** argv, QString& restartProgram, QStrinreturn 1;}if (testSize.isValid()) window->resize(testSize);- if(!softwareUi){- auto windows=window->findChildren<QQuickWindow*>();windows.prepend(window);- for(auto* quick:windows){- auto gate=veyra::gfx::registerObsQtFrameGate();- QObject::connect(quick,&QQuickWindow::beforeFrameBegin,quick,[gate]{- gate->beginFrame(GetModuleHandleW(L"graphics-hook64.dll")!=nullptr);- },Qt::DirectConnection);- QObject::connect(quick,&QQuickWindow::afterFrameEnd,quick,[gate]{gate->endFrame();},Qt::DirectConnection);- QObject::connect(quick,&QQuickWindow::sceneGraphInvalidated,quick,[gate]{gate->endFrame();},Qt::DirectConnection);- }- veyra::log::info("qml-window",std::format("OBS resize frame gates registered windows={}",windows.size()));- }// Fullscreen must own the whole monitor. Without telling the shell, the taskbar// stayed above the fullscreen picture on some systems (field report with thediff --git a/include/veyra/gfx/ObsQtFrameGate.h b/include/veyra/gfx/ObsQtFrameGate.hdeleted file mode 100644index 089ca645..00000000--- a/include/veyra/gfx/ObsQtFrameGate.h+++ /dev/null@@ -1,53 +0,0 @@-#pragma once-#include <memory>-#include <mutex>-#include <vector>--namespace veyra::gfx {-// OBS 32.1.2 dxgi-capture.cpp clears process-wide capture state at the start-// of ANY ResizeBuffers. Qt and the native video must not race to Present-// during that call. Each Qt window keeps its own gate (no UI/UI lock order).-class ObsQtFrameGate {-public:- void beginFrame(bool hookActive) {- if(hookActive&&!held_){mutex_.lock();held_=true;}- }- void endFrame() {- if(held_){held_=false;mutex_.unlock();}- }- std::mutex& mutex(){return mutex_;}-private:- std::mutex mutex_;- bool held_=false; // accessed only by this window's render thread-};-inline std::mutex obsQtRegistryMutex;-inline std::vector<std::weak_ptr<ObsQtFrameGate>> obsQtFrameGates;-inline std::shared_ptr<ObsQtFrameGate> registerObsQtFrameGate(){- auto gate=std::make_shared<ObsQtFrameGate>();- const std::lock_guard lock(obsQtRegistryMutex);- std::erase_if(obsQtFrameGates,[](const auto& existing){return existing.expired();});- obsQtFrameGates.push_back(gate);- return gate;-}-class ObsNativeResizeHold {-public:- ObsNativeResizeHold(){- {- const std::lock_guard lock(obsQtRegistryMutex);- for(auto& entry:obsQtFrameGates)if(auto gate=entry.lock())gates_.push_back(std::move(gate));- }- for(auto& gate:gates_){- locks_.emplace_back(gate->mutex(),std::try_to_lock);- if(!locks_.back().owns_lock()){- locks_.clear();ready_=false;break;- }- }- }- bool ready()const{return ready_;}- size_t windows()const{return gates_.size();}-private:- std::vector<std::shared_ptr<ObsQtFrameGate>> gates_;- std::vector<std::unique_lock<std::mutex>> locks_;- bool ready_=true;-};-}diff --git a/src/engine/VideoPresenter.cpp b/src/engine/VideoPresenter.cppindex 077f6fa0..bd38b54f 100644--- a/src/engine/VideoPresenter.cpp+++ b/src/engine/VideoPresenter.cpp@@ -3,7 +3,6 @@#include "veyra/pipeline/EnhanceGraph.h"#include "veyra/gfx/D3D12DeviceContext.h"#include "veyra/gfx/CommandSlotRing.h"-#include "veyra/gfx/ObsQtFrameGate.h"#include "veyra/sink/ImageExportSink.h"namespace veyra::engine {bool VideoPresenter::beginSourceInput(){@@ -138,14 +137,7 @@ bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing&SUCCEEDED(ctx.device()->GetDeviceRemovedReason())&&!GetEnvironmentVariableW(L"VEYRA_TEST_DISABLE_PAUSED_PRESENT_REUSE",nullptr,0))return true;retainedFrame_.reset(); // A failed present never seeds an idle cache.- bool resizeReady=!windowChanging&&(targetWidth!=sink_.width()||targetHeight!=sink_.height())&&GetTickCount64()>=deferUntil&&now-lastResize_>=std::chrono::milliseconds(100)&&sink_.resizeDue();- std::optional<gfx::ObsNativeResizeHold> captureResizeHold;- if(resizeReady&&GetModuleHandleW(L"graphics-hook64.dll")){- captureResizeHold.emplace();resizeReady=captureResizeHold->ready();- if(!resizeReady)captureResizeHold.reset(); // no native wait; retry next frame- else veyra::log::info("capture-resize",std::format("exclusive native resize target={}x{} qtWindows={}",targetWidth,targetHeight,captureResizeHold->windows()));- }- if(resizeReady) {+ if(!windowChanging&&(targetWidth!=sink_.width()||targetHeight!=sink_.height())&&GetTickCount64()>=deferUntil&&now-lastResize_>=std::chrono::milliseconds(100)&&sink_.resizeDue()) {resized=true;if(!ring.drainQueue())return false;sink_.resize(targetWidth,targetHeight);// A capture hook may temporarily retain a DXGI buffer. Keep the old@@ -283,7 +275,6 @@ bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing&const auto dxgiStart=std::chrono::steady_clock::now();reflex_.mark(reflexFrame_,3);reflex_.mark(reflexFrame_,4);const bool presented=sink_.present(st);- captureResizeHold.reset(); // release Qt immediately after the native Presentreflex_.mark(reflexFrame_,5);reflexFrame_=0;const auto presentEnd=std::chrono::steady_clock::now();const auto ms=[](auto d){return std::chrono::duration<double,std::milli>(d).count();};