Skip to content

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++

fix(capture): N2 CLI plumbing fixed, callback handoff clean (commits=479/0 drops); stall narrowed to the presenter

Veyra Goal Agent406bdf1fcdc5
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index 493c2640..4f5f2c24 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -10,6 +10,8 @@
**同日后续(根因修复 + 新的阻塞点)**:定位到最可能的根因——**上传 fence 索引错位**:图按自己的 parity 记录提交 fence,但直接模式下缓冲槽位由源决定,丢帧后两者错位,源会在 GPU 仍在读取该缓冲时覆盖它(表现为 GPU-ready 84ms、每帧 reset、10fps 自激)。已修:直接帧的提交 fence 同时记录到其缓冲槽位(`uploadFences_[slot]`),并加了回调侧直接提交/回退计数(每 120 帧一条日志)。重跑时又发现 **`--capture-direct-ingress` 没有真正触发 attach**(日志无 `[capture-direct]`):根因是 `options()` 从引擎快照重建 `PlayerOptions` 时丢弃了 CLI-only 字段;已修(`options()` 现在携带 `captureCpuUnpack`/`captureDirectIngress`)。截至本轮结束,**带 attach 的直接路径尚未完成真机复测**:默认(信箱)路径健康、门禁 PASS(`logs/delivery/5b494cdb690d4254a670d1d14ccfe54e/result.json`),直接路径继续默认关闭。下一步:用 `--capture-direct-ingress` 复测确认 attach→直接提交计数→4K18 A/B,再决定是否转默认。
+**同日第三次修正(CLI 管道修好后的实测,14:29/14:31)**:`EngineController::open()` 还会用 `PlayerOptions::from(desired_)` 重建 options——这是字段丢失的真正位置(只显式保留了 captureReplay 两字段)。已修并复测:**attach 成功**(`[capture-direct] graph direct ingress attached`),回调计数证实直接路径全程在用:`commits=479 fallbacks=1 drops=0`(每 120 帧一条)。读取侧也不再因 fence 未完成而误丢帧(新增 `ingressSlotBuffer` 无 fence 的"当前缓冲"校验,仅比对缓冲指针;回调写入前仍用带 fence 的 `tryPrepareIngressSlot`)。**但引擎仍退化**:`processed=102/565`、`displaySubmits=1`、`firstValidObserveMs=89.3ms`、每帧一次 history reset、P95 177ms——**说明卡点已不在"回调→图缓冲"的交接层,而在呈现/实时调度路径**(直接视图帧作为图输入后,呈现只提交了 1 次;信箱路径同条件 displaySubmits≈processed)。N2 继续默认关闭,下一步聚焦:直接帧与信箱帧的 `pkt`/frame 字段逐项对比(pts/arrival、frame 指针身份、view 的 buf[0]=null 对 live scheduler/presenter 的影响),定位为何呈现停摆。
+
## 2026-09-16 采集链路 N1:逐像素转换从 CPU 挪到 GPU
- 采集侧:`captureMediaLayout` 对 UYVY/YVYU/BGR24/RGB555/RGB565 保留驱动真实 packing(UYVY422/YVYU422/BGR24/RGB555LE/RGB565LE);`copyCaptureSample` 改为按行原样拷贝(保留 DIB 方向契约、手动翻转与 YUV 色度行跟随);新增 `captureLegacyCpuLayout` + `--capture-cpu-unpack` 诊断开关,旧 BGR0/YUY2 逐像素转换仍可回退。
diff --git a/include/veyra/pipeline/EnhanceGraph.h b/include/veyra/pipeline/EnhanceGraph.h
index 37eeae62..c22f6a47 100644
--- a/include/veyra/pipeline/EnhanceGraph.h
+++ b/include/veyra/pipeline/EnhanceGraph.h
@@ -134,6 +134,10 @@ public:
// still in flight, so the capture callback can fall back to its mailbox
// instead of blocking the DirectShow thread on a GPU fence.
bool tryPrepareIngressSlot(unsigned slot,void*& buffer,size_t& capacity,unsigned& pitch,unsigned& rowBytes);
+ // Cheap freshness probe for the consumer: current mapped buffer of a slot,
+ // no fence wait (the consumer only checks that the frame it committed still
+ // belongs to the live graph generation).
+ bool ingressSlotBuffer(unsigned slot,void*& buffer) const;
struct FrameOutputs {
FrameBatch batch;
diff --git a/include/veyra/source/CaptureCardSource.h b/include/veyra/source/CaptureCardSource.h
index d301520f..21187b87 100644
--- a/include/veyra/source/CaptureCardSource.h
+++ b/include/veyra/source/CaptureCardSource.h
@@ -63,6 +63,8 @@ public:
struct DirectIngressHooks {
void* context=nullptr;
bool (*prepare)(void* context,unsigned slot,void*& buffer,size_t& capacity,unsigned& pitch,unsigned& rowBytes)=nullptr;
+ // Consumer-side freshness probe: current buffer of a slot, no fence wait.
+ bool (*current)(void* context,unsigned slot,void*& buffer)=nullptr;
};
bool attachDirectIngress(const DirectIngressHooks& hooks);
void detachDirectIngress();
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index a4190fb5..78348c96 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -62,9 +62,15 @@ bool EngineController::idle()const{std::lock_guard lock(mutex_);return !busy_&&!
void EngineController::open(HWND video,const std::wstring& path,PlayerOptions opts){
const bool captureReplay=opts.captureReplayForTest;
const bool disableAdmission=opts.captureReplayDisableFgAdmissionForTest;
+ // Diagnostics-only PlayerOptions fields never enter EnhancementSettings;
+ // keep them across the snapshot round-trip below.
+ const bool captureCpuUnpack=opts.captureCpuUnpack;
+ const bool captureDirectIngress=opts.captureDirectIngress;
{std::lock_guard lock(mutex_);snapshot_={};activeFlow_.reset();previewView_={};fgMultiFrameMaxCap_=0;xessMaxInterpolatedFramesCap_=0;fsrMaxGeneratedFramesCap_=0;snapshot_.sessionId=++sessionId_;snapshot_.transport=TransportState::Opening;savePath_.clear();desired_=opts.snapshot();desired_.revision=++nextRevision_;snapshot_.desired=desired_;opts=PlayerOptions::from(desired_);}
opts.captureReplayForTest=captureReplay;
opts.captureReplayDisableFgAdmissionForTest=disableAdmission;
+ opts.captureCpuUnpack=captureCpuUnpack;
+ opts.captureDirectIngress=captureDirectIngress;
post([this,video,path,opts]{paused_=false;seekSeconds_=-1;run(video,path,opts);});
}
#ifdef VEYRA_ENABLE_REMOTEPLAY
@@ -285,6 +291,8 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
hooks.context=&graph;
hooks.prepare=[](void* context,unsigned slot,void*& buffer,size_t& capacity,unsigned& pitch,unsigned& rowBytes){
return static_cast<pipeline::EnhanceGraph*>(context)->tryPrepareIngressSlot(slot,buffer,capacity,pitch,rowBytes);};
+ hooks.current=[](void* context,unsigned slot,void*& buffer){
+ return static_cast<pipeline::EnhanceGraph*>(context)->ingressSlotBuffer(slot,buffer);};
if(captureSource.attachDirectIngress(hooks))veyra::log::info("capture-direct","N2 direct capture ingress enabled");
}
failure=FailedBackend::Infrastructure;
diff --git a/src/pipeline/EnhanceGraph.cpp b/src/pipeline/EnhanceGraph.cpp
index fe534f06..dd7abda9 100644
--- a/src/pipeline/EnhanceGraph.cpp
+++ b/src/pipeline/EnhanceGraph.cpp
@@ -1706,6 +1706,12 @@ bool EnhanceGraph::prepareIngressSlot(unsigned slot,void*& buffer,size_t& capaci
if(uploadFences_[slot]&&!context_.waitForFenceValue(uploadFences_[slot]))return false;
return tryPrepareIngressSlot(slot,buffer,capacity,pitch,rowBytes);
}
+bool EnhanceGraph::ingressSlotBuffer(unsigned slot,void*& buffer) const{
+ buffer=nullptr;
+ if(slot>1||!ingressDirectReady_.load()||!upRgb_[slot]||!mappedRgb_[slot])return false;
+ buffer=mappedRgb_[slot];
+ return true;
+}
void EnhanceGraph::shutdown()
{
ingressDirectReady_.store(false);
diff --git a/src/source/CaptureCardSource.cpp b/src/source/CaptureCardSource.cpp
index dd8a5a7f..7f337ab1 100644
--- a/src/source/CaptureCardSource.cpp
+++ b/src/source/CaptureCardSource.cpp
@@ -310,7 +310,7 @@ void CaptureCardSource::setCpuUnpack(bool enabled){
}
bool CaptureCardSource::attachDirectIngress(const DirectIngressHooks& hooks){
auto& p=*p_;
- if(!hooks.prepare)return false;
+ if(!hooks.prepare||!hooks.current)return false;
std::lock_guard lock(p.mutex);
if(!p.configured||p.layout.planes!=1)return false;
for(auto*& view:p.directView){if(!view)view=av_frame_alloc();if(!view)return false;}
@@ -763,7 +763,7 @@ SourceReadStatus CaptureCardSource::readWithWait(pipeline::FramePacket& packet,c
if(slot>=0){
const unsigned s=unsigned(slot);
void* buffer=nullptr;size_t capacity=0;unsigned pitch=0,rowBytes=0;
- if(p.direct.prepare&&p.direct.prepare(p.direct.context,s,buffer,capacity,pitch,rowBytes)&&buffer==p.directCommitted[s]){
+ if(p.direct.current&&p.direct.current(p.direct.context,s,buffer)&&buffer==p.directCommitted[s]){
p.directInUse[s].store(true);p.directSlot=int(s);p.directPending=false;
outFrame=p.directView[s];time=p.directTime;p.readArrival=p.directArrival;duration=p.directDuration;
}else{