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): Magewell SDK stops DirectShow video, overlay hook detection, resize backoff, driver frame age
Veyra Goal Agent304d4b787854
diff --git a/docs/TEST_PACKAGE_2.0.0beta6.md b/docs/TEST_PACKAGE_2.0.0beta6.mdindex 457f44d7..163852f2 100644--- a/docs/TEST_PACKAGE_2.0.0beta6.md+++ b/docs/TEST_PACKAGE_2.0.0beta6.md@@ -10,6 +10,13 @@- **极简模式什么都没打开**:点画面弹出片源菜单。- **竖屏视频 / 竖屏窗口捕获,窗口超出屏幕**:窗口高度不再超过屏幕,放不下时窗口变窄;换回横屏片源或离开极简模式会恢复宽度。+- **美乐威低延迟只有二三十帧、输入时间线异常、补帧不稳**:低延迟其实启动了,但原来的普通采集还在后台同时跑,两路 4K 数据抢采集卡带宽,都掉到约 28 帧。+ 现在低延迟出帧后会停掉普通采集(音频选的是 WASAPI 端点或不要音频时);低延迟意外停止会自动切回普通采集。**美乐威用户请把音频选成采集卡的 WASAPI 端点**,再测一次帧率和延迟,日志搜 `magewell`。+- **装了游加加(GamePP)的电脑**:游加加的帧数显示 / 滤镜会注入本软件,导致改窗口大小失败、全屏底部露出任务栏、改设置后"视频初始化失败"、窗口化时崩溃。+ 软件检测到会弹提示。请在游加加里关闭对 Veyra 的帧数显示 / 滤镜,或退出游加加。+- **改补帧方式、光流算法等参数时画面停一两秒(声音不停)**:这是重建处理链,目前约 1.7 秒,暂未优化;不是死机。+- **GC573 采集延迟**:新版日志每 10 秒记录一次驱动交帧时这一帧已经多旧(搜 `capture-driver-age`)。请延迟高和正常的 GC573 用户用同样的格式各发一份日志。+详细记录见包内 `docs/UI_FIELD_FIXES_2026-10-01.md`。---diff --git a/docs/UI_FIELD_FIXES_2026-10-01.md b/docs/UI_FIELD_FIXES_2026-10-01.mdindex 28801b1b..5e551f24 100644--- a/docs/UI_FIELD_FIXES_2026-10-01.md+++ b/docs/UI_FIELD_FIXES_2026-10-01.md@@ -24,8 +24,35 @@- 全屏 → 顶栏点专业 → 退出全屏并进入专业页(07)。- 第 5 条:日志确认每次切换来源都先清空视频窗口(`blank video until the new source presents`),新来源出画面后恢复。**没有连 PS5 实测**,慢连接期间的实际观感要你用 PS5 再试一次。+## 第二批:采集卡与美乐威(同日,用户本机 beta 5 日志 + 美乐威用户日志/转储)++美乐威用户:RTX 5090 + Pro Capture HDMI 4K+,3840×2160 59.94 P010,音频走 WASAPI,`D:\Veyra-2.0.0beta5`。++| 现象 | 日志证据 | 原因 | 修改 |+|------|----------|------|------|+| 美乐威低延迟"不确定是否生效"、输入时间线异常、补帧 2X 游戏帧不稳 | 低延迟确实启动(`low-latency video started`),但只送出 20–40 帧(600 帧用 21.6 秒);"开始进卡到完整进内存" 42–49 ms(正常约 17 ms);35 秒内时间线重置 319 次,全部是 `PtsDiscontinuity`;软件因此误判为 30 帧内容(`capture60To30=true`) | SDK 低延迟线程采集时,DirectShow 视频采集仍在运行(只是帧被丢弃)。4K60 P010 一路约 1.5 GB/s,两路同时 DMA 超过卡的 PCIe 带宽,两路都掉到约 28 帧;帧间隔超过 41.7 ms 被判为断点 | 低延迟送出 30 帧后停止 DirectShow 图(只在音频不在图里时,如 WASAPI 或无音频);SDK 线程意外结束时自动恢复 DirectShow。音频来自 DirectShow 设备时保持原样并在日志提示改用 WASAPI 音频 |+| 改光流 / 画质后"视频初始化失败" | `CreateSwapChainForHwnd failed hr=0x80070005`,`设置失败且旧资源恢复失败,已停止` | 旧交换链被外部钩子拿着没释放,系统拒绝在同一窗口建新的 | 重建交换链时被拒绝,重试由 2 次约 0.1 秒延长到 8 次约 1.3 秒;根因见下一行 |+| 全屏底部留一条任务栏;窗口化后崩溃 | 视频交换链 `ResizeBuffers` 每次都失败(0x887A0001);**界面自己的 D3D11 交换链也失败**(`Failed to resize D3D11 swapchain`);转储:崩溃在 NVIDIA 驱动 nvwgf2umx.dll 的 D3D11 工作线程,进程里注入了游加加(GamePP)的 `GPP64.dll`、`GameTracker64.dll`、`shade64.dll` | 两个互不相干的交换链同时改不了大小,说明是进程外注入的叠加层(游加加的帧数显示 / 滤镜)拿着缓冲区 | 启动后检测游加加、RTSS、OBS 游戏捕获、Discord、Steam 叠加层并记日志;发现游加加时弹出提示,建议关闭它对 Veyra 的帧数显示 / 滤镜或退出。ResizeBuffers 失败后重试间隔从每 100 ms 改为 0.2 → 3.2 秒逐步拉长,日志不再刷屏 |++用户本机(KUHAIMI 27P,2560×1440 60,beta 5):++| 现象 | 日志证据 | 原因 | 处理 |+|------|----------|------|------|+| 调参数时画面卡住、有声音 | 每次改补帧方式 / 光流算法等,`engine-stall` 1.6–3.1 秒后恢复;一次重建:销毁 0.16 s,创建 1.56 s,其中 NVIDIA NGX 核心重新初始化 1.07 s | 这类参数要重建整条处理链,期间不出画面,声音照常 | **本轮未改**:NGX 核心的装卸和 40/30 系补帧解锁补丁绑在一起,保留核心需要重排补丁顺序,风险大,单独立项 |++GC573 采集延迟(`veyra-app(1).log`,1.4.4,RTX 5080,4K60 YUY2/P010):软件内部从收到帧到提交显示约 3 ms;驱动无视了"1 个缓冲"的请求,实际用 4 个(`driver ignored`);该会话开了"采集 60→30"。延迟若在驱动内部排队,现有日志测不到。新增 `[capture-driver-age]`:每 600 帧记录一次"驱动时间戳到我们收到"的 p50/p95 和驱动缓冲数。本机 KUHAIMI 1080p120 实测 p50 26 ms、10 个缓冲。++另:34 处 `onToggled` 处理器改为显式参数(日志里的 `Parameter "checked" is not declared` 报错)。++### 第二批验证++- 构建通过;QML 组件测试通过;本机 KUHAIMI 采集 25 秒:120 fps、0 丢帧,`capture-driver-age` 正常输出(`tests/ui-fixes-20261001/capture1`)。+- **未验证**:美乐威停掉 DirectShow 后的帧率与延迟(没有美乐威卡);游加加提示(本机没装游加加);交换链重试延长对游加加是否够用。+## 未解决- 第 5 条里,没连上的 PS5 旧会话关闭要 18 秒,是串流库停止连接时在等它自己的超时;这段时间现在显示"正在连接",但第二次连接仍要等它关完。- 第一次 PS5 连接 20 秒没连上的原因看不出来(主机没有回应);如果经常这样,请再发日志。- 反馈里"有声音":日志里第一次连接期间 PS5 没有任何音频数据,采集卡音频也已停止,声音来源不明。+- 改参数重建处理链约 1.7 秒不出画面(其中 NGX 核心重新初始化 1.07 秒),需单独优化。+- GC573 部分用户延迟高:等两位用户(高延迟 / 正常)用 beta 6 同设置各发一份日志,对比 `capture-driver-age`。diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex 69823bf6..40d5e792 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -4,6 +4,7 @@- 7 条反馈的原因与修改见 `docs/UI_FIELD_FIXES_2026-10-01.md`:极简播放条拖动窗口、全屏顶栏进专业页、GPU 阶段条每次刷新重建(0/5.8 跳动)、负载预算改为耗时/预算、换来源时清空视频窗口(PS5 慢连接时不再停在采集卡最后一帧)、空极简页点击弹片源菜单、竖屏片源窗口不超出屏幕。- 构建 `veyra_qml_ui` 与三项 QML 测试通过;`scripts/ui-check/ui-check.py` 真实程序点击/拖动/截图 PASS,证据 `E:/项目/Veyra/tests/ui-fixes-20261001/run5/`。PS5 慢连接未实测(不连接用户主机)。+- 第二批(同日,用户本机 beta 5 日志、美乐威用户日志与转储、1.4.4 GC573 类日志):美乐威低延迟运行时停掉 DirectShow 视频(两路 4K DMA 抢带宽,只剩约 28 帧、时间线每帧重置);检测游加加等注入叠加层并提示(转储与两条交换链同时 ResizeBuffers 失败指向它);ResizeBuffers 失败退避重试、交换链被拒时延长重试;新增 `[capture-driver-age]`;34 处 onToggled 显式参数。改参数重建约 1.7 秒(NGX 核心重初始化 1.07 秒)本轮未改。本机 KUHAIMI 采集 120 fps / 0 丢帧,证据 `tests/ui-fixes-20261001/capture1`。美乐威、游加加未实测。- 同分支此前的串流与美乐威工作见 `docs/STREAM_FIELD_FIXES_2026-10-01.md`、`docs/MAGEWELL_LOW_LATENCY_2026-10-01.md`。## 2026-10-01 2.0.0 合并 main 与分支整理diff --git a/include/veyra/gfx/PresentSink.h b/include/veyra/gfx/PresentSink.hindex 4b34c065..7007ce54 100644--- a/include/veyra/gfx/PresentSink.h+++ b/include/veyra/gfx/PresentSink.h@@ -124,6 +124,8 @@ public:bool xessFailed() const { return xessFailed_; }void shutdown();+ // False while a failed ResizeBuffers is backing off (see resize()).+ bool resizeDue() const;private:static LRESULT CALLBACK wndProcThunk(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);@@ -147,6 +149,10 @@ private:bool tearingSupported_ = false;UINT swapChainFlags_ = 0;bool pendingResize_ = false;+ // ResizeBuffers failures in a row and when the last one happened: retries back off+ // instead of draining the queue every 100 ms while something holds the buffers.+ uint32_t resizeFailures_ = 0;+ uint64_t lastResizeFailureMs_ = 0;bool xessFailed_ = false;ID3D12Device* device_ = nullptr;ID3D12CommandQueue* queue_ = nullptr;diff --git a/qml/Veyra/DialogHost.qml b/qml/Veyra/DialogHost.qmlindex 20b37319..8b685c43 100644--- a/qml/Veyra/DialogHost.qml+++ b/qml/Veyra/DialogHost.qml@@ -341,7 +341,7 @@ Item {enabled: veyra.captureMagewellDeviceopacity: enabled ? 1 : 0.35checked: veyra.captureMagewellDevice && veyra.preferences.magewellLowLatency === true- onToggled: veyra.setPreference("magewellLowLatency", checked)+ onToggled: checked => veyra.setPreference("magewellLowLatency", checked)}}VRow {@@ -411,7 +411,7 @@ Item {hint: "收到 HDR 也按 SDR 预览,立即生效"VSwitch {checked: veyra.captureForceSdr- onToggled: veyra.captureForceSdr = checked+ onToggled: checked => veyra.captureForceSdr = checked}}VRow {@@ -419,7 +419,7 @@ Item {hint: "采集画面倒置时开启,立即生效"VSwitch {checked: veyra.captureFlipVertical- onToggled: veyra.captureFlipVertical = checked+ onToggled: checked => veyra.captureFlipVertical = checked}}}@@ -553,7 +553,7 @@ Item {VRow {label: "仅观看"hint: "不向 PS5 转发电脑手柄输入"- VSwitch { checked: veyra.ps5.viewOnly === true; onToggled: veyra.ps5Set("viewOnly", checked) }+ VSwitch { checked: veyra.ps5.viewOnly === true; onToggled: checked => veyra.ps5Set("viewOnly", checked) }}VRow {label: "陀螺仪"@@ -868,7 +868,7 @@ Item {VRow {label: "HDR"hint: mlDialog.st.hdrHost ? "需要主机显示器开启 HDR,且编码选 HEVC 或 AV1;本机需要硬件解码" : "这台主机没有报告 10 位编码能力"- VSwitch { objectName: "moonlight-hdr"; enabled: !!mlDialog.st.hdrHost || mlDialog.cfg.hdr === true; checked: mlDialog.cfg.hdr === true; onToggled: mlDialog.ml.set("hdr", checked) }+ VSwitch { objectName: "moonlight-hdr"; enabled: !!mlDialog.st.hdrHost || mlDialog.cfg.hdr === true; checked: mlDialog.cfg.hdr === true; onToggled: checked => mlDialog.ml.set("hdr", checked) }}VRow {label: "声道"@@ -882,22 +882,22 @@ Item {VRow {label: "手柄"hint: "把电脑手柄当作主机上的 Xbox 手柄(1 号)"- VSwitch { objectName: "moonlight-gamepad"; checked: mlDialog.cfg.gamepad !== false; onToggled: mlDialog.ml.set("gamepad", checked) }+ VSwitch { objectName: "moonlight-gamepad"; checked: mlDialog.cfg.gamepad !== false; onToggled: checked => mlDialog.ml.set("gamepad", checked) }}VRow {label: "自动捕获键盘鼠标"hint: "开始后键鼠交给主机;Ctrl+Alt+Shift+Z 释放,+Q 断开,+S 统计"- VSwitch { objectName: "moonlight-capture"; checked: mlDialog.cfg.captureInput !== false; onToggled: mlDialog.ml.set("captureInput", checked) }+ VSwitch { objectName: "moonlight-capture"; checked: mlDialog.cfg.captureInput !== false; onToggled: checked => mlDialog.ml.set("captureInput", checked) }}VRow {label: "让主机切换到串流分辨率"hint: "关闭时主机保持自己的分辨率,画面由主机缩放"- VSwitch { objectName: "moonlight-sops"; checked: mlDialog.cfg.sops === true; onToggled: mlDialog.ml.set("sops", checked) }+ VSwitch { objectName: "moonlight-sops"; checked: mlDialog.cfg.sops === true; onToggled: checked => mlDialog.ml.set("sops", checked) }}VRow {label: "主机同时出声"hint: "默认只在本机出声"- VSwitch { objectName: "moonlight-hostaudio"; checked: mlDialog.cfg.hostAudio === true; onToggled: mlDialog.ml.set("hostAudio", checked) }+ VSwitch { objectName: "moonlight-hostaudio"; checked: mlDialog.cfg.hostAudio === true; onToggled: checked => mlDialog.ml.set("hostAudio", checked) }}}DNote { objectName: "moonlight-status"; visible: (mlDialog.st.status || "").length > 0; text: (mlDialog.st.busy ? "处理中 · " : "") + (mlDialog.st.status || "") }@@ -1039,7 +1039,7 @@ Item {VRow {label: "手柄"hint: "把电脑手柄当作主机上的手柄"- VSwitch { objectName: "xbox-gamepad"; checked: xbDialog.st.gamepad !== false; onToggled: xbDialog.xb.set("gamepad", checked) }+ VSwitch { objectName: "xbox-gamepad"; checked: xbDialog.st.gamepad !== false; onToggled: checked => xbDialog.xb.set("gamepad", checked) }}}DNote { objectName: "xbox-status"; visible: (xbDialog.st.status || "").length > 0; text: (xbDialog.st.busy ? "处理中 · " : "") + (xbDialog.st.status || "") }@@ -1121,7 +1121,7 @@ Item {VSwitch {enabled: screenDialog.o.method === 0checked: screenDialog.o.cursor === true- onToggled: veyra.setScreenOption("cursor", checked)+ onToggled: checked => veyra.setScreenOption("cursor", checked)}}VRow {@@ -1273,7 +1273,7 @@ Item {hint: "打开新文件时自动选第二条可用字幕"VSwitch {checked: subtitleDialog.pref("subtitleSecondLanguage", false)- onToggled: veyra.setPreference("subtitleSecondLanguage", checked)+ onToggled: checked => veyra.setPreference("subtitleSecondLanguage", checked)}}}@@ -1314,7 +1314,7 @@ Item {VSwitch {objectName: "subtitle-enabled"checked: subtitleDialog.pref("subtitleEnabled", true)- onToggled: veyra.setPreference("subtitleEnabled", checked)+ onToggled: checked => veyra.setPreference("subtitleEnabled", checked)}}VRow {@@ -1351,7 +1351,7 @@ Item {label: "背景条"VSwitch {checked: subtitleDialog.pref("subtitleBackground", false)- onToggled: veyra.setPreference("subtitleBackground", checked)+ onToggled: checked => veyra.setPreference("subtitleBackground", checked)}}VRow {@@ -1369,7 +1369,7 @@ Item {hint: "默认保持字号;开启后超过目标行数才缩小"VSwitch {checked: subtitleDialog.pref("subtitleFit", false)- onToggled: veyra.setPreference("subtitleFit", checked)+ onToggled: checked => veyra.setPreference("subtitleFit", checked)}}VRow {@@ -1467,7 +1467,7 @@ Item {label: "静音"VSwitch {checked: veyra.muted- onToggled: veyra.muted = checked+ onToggled: checked => veyra.muted = checked}}}@@ -1520,7 +1520,7 @@ Item {VSwitch {objectName: "audio-stereo"checked: veyra.preferences.audioForceStereo === true- onToggled: veyra.setPreference("audioForceStereo", checked)+ onToggled: checked => veyra.setPreference("audioForceStereo", checked)}}}diff --git a/qml/Veyra/NodePage.qml b/qml/Veyra/NodePage.qmlindex 17f884b3..53ef47fd 100644--- a/qml/Veyra/NodePage.qml+++ b/qml/Veyra/NodePage.qml@@ -620,7 +620,7 @@ VPage {Layout.fillWidth: truevisible: veyra.opticalFlowChoice === 1NodeLabel { Layout.fillWidth: true; text: "AMD 性能档(宽高减半)" }- VSwitch { objectName: "node-amd-half"; checked: veyra.amdFlowHalf; onToggled: veyra.amdFlowHalf = checked }+ VSwitch { objectName: "node-amd-half"; checked: veyra.amdFlowHalf; onToggled: checked => veyra.amdFlowHalf = checked }}NodeLabel { text: "内容节奏" }VSelect {@@ -681,7 +681,7 @@ VPage {onMoved: value => veyra.volume = value}Text { text: Math.round(veyra.volume * 100) + "%"; color: Theme.t2; font.family: Theme.fontMono; font.pixelSize: 10 }- VSwitch { objectName: "node-out-mute"; checked: !veyra.muted; onToggled: veyra.muted = !checked }+ VSwitch { objectName: "node-out-mute"; checked: !veyra.muted; onToggled: checked => veyra.muted = !checked }}VSeg {objectName: "node-out-sync"@@ -1286,7 +1286,7 @@ VPage {VSwitch {objectName: "node-enable-" + card.node.idchecked: card.node.enabled === true- onToggled: veyra.setEffectEnabled(card.node.index, checked)+ onToggled: checked => veyra.setEffectEnabled(card.node.index, checked)}VButton {objectName: "node-unlink-" + card.node.id@@ -1426,12 +1426,12 @@ VPage {VRow {label: "严格补帧节奏"hint: "帧同步 · 默认关闭"- VSwitch { checked: veyra.fgStrict; onToggled: veyra.fgStrict = checked }+ VSwitch { checked: veyra.fgStrict; onToggled: checked => veyra.fgStrict = checked }}VRow {label: "低延迟队列"hint: "减少排队;不宣称延迟下降"- VSwitch { checked: veyra.fgLowQueue; onToggled: veyra.fgLowQueue = checked }+ VSwitch { checked: veyra.fgLowQueue; onToggled: checked => veyra.fgLowQueue = checked }}}}diff --git a/qml/Veyra/NrLayerEditor.qml b/qml/Veyra/NrLayerEditor.qmlindex 89b16008..42af4602 100644--- a/qml/Veyra/NrLayerEditor.qml+++ b/qml/Veyra/NrLayerEditor.qml@@ -209,7 +209,7 @@ ColumnLayout {hint: "低延迟顺序,仅预览、全层同步"VSwitch {checked: editor.nrFirst- onToggled: editor.orderEdited(checked)+ onToggled: checked => editor.orderEdited(checked)}}}diff --git a/qml/Veyra/ProPage.qml b/qml/Veyra/ProPage.qmlindex 18361d55..1deef2d2 100644--- a/qml/Veyra/ProPage.qml+++ b/qml/Veyra/ProPage.qml@@ -1081,7 +1081,7 @@ VPage {+ (veyra.videoSrQuality > 0 ? " · 质量 " + veyra.videoSrQuality : "")on: veyra.srEnabledopen: true- onToggled: veyra.srEnabled = on+ onToggled: on => veyra.srEnabled = onVRow {label: "目标尺寸"@@ -1130,7 +1130,7 @@ VPage {title: "RTX Video HDR"summary: veyra.videoHdr ? (veyra.videoHdrStatus.length > 0 ? veyra.videoHdrStatus : "已开启") : "已关闭"on: veyra.videoHdr- onToggled: veyra.videoHdr = on+ onToggled: on => veyra.videoHdr = onRepeater {model: [{key:"contrast",label:"对比度",from:0,to:200,def:125},{key:"saturation",label:"饱和度",from:0,to:200,def:75},@@ -1439,7 +1439,7 @@ VPage {hint: "帧同步 · 默认关闭"VSwitch {checked: veyra.fgStrict- onToggled: veyra.fgStrict = checked+ onToggled: checked => veyra.fgStrict = checked}}VSubGroup {@@ -1466,7 +1466,7 @@ VPage {VSwitch {objectName: "list-amd-half"checked: veyra.amdFlowHalf- onToggled: veyra.amdFlowHalf = checked+ onToggled: checked => veyra.amdFlowHalf = checked}}VRow {@@ -1496,7 +1496,7 @@ VPage {VSwitch {objectName: "list-low-queue"checked: veyra.fgLowQueue- onToggled: veyra.fgLowQueue = checked+ onToggled: checked => veyra.fgLowQueue = checked}}}@@ -1531,7 +1531,7 @@ VPage {label: "静音"VSwitch {checked: veyra.muted- onToggled: veyra.muted = checked+ onToggled: checked => veyra.muted = checked}}VRow {@@ -1641,7 +1641,7 @@ VPage {VSwitch {objectName: "display-hold-compare"checked: veyra.preferences.holdCompare !== false- onToggled: veyra.setPreference("holdCompare", checked)+ onToggled: checked => veyra.setPreference("holdCompare", checked)}}VRow {@@ -1660,7 +1660,7 @@ VPage {VSwitch {objectName: "display-force-sdr"checked: veyra.captureForceSdr- onToggled: veyra.captureForceSdr = checked+ onToggled: checked => veyra.captureForceSdr = checked}}VRow {diff --git a/qml/Veyra/SettingsPage.qml b/qml/Veyra/SettingsPage.qmlindex 87d003b7..63f72785 100644--- a/qml/Veyra/SettingsPage.qml+++ b/qml/Veyra/SettingsPage.qml@@ -194,7 +194,7 @@ VPage {hint: "关闭弹性与转场"VSwitch {checked: veyra.reducedMotion- onToggled: veyra.reducedMotion = checked+ onToggled: checked => veyra.reducedMotion = checked}}VRow {@@ -300,7 +300,7 @@ VPage {VSwitch {objectName: "set-resume"checked: veyra.preferences.rememberPosition !== false- onToggled: veyra.setPreference("rememberPosition", checked)+ onToggled: checked => veyra.setPreference("rememberPosition", checked)}}VRow {diff --git a/qml/Veyra/VAccordion.qml b/qml/Veyra/VAccordion.qmlindex 1af33ea6..d877a2c5 100644--- a/qml/Veyra/VAccordion.qml+++ b/qml/Veyra/VAccordion.qml@@ -166,7 +166,7 @@ Rectangle {objectName: acc.switchObjectNamevisible: acc.enabledSwitchchecked: acc.on- onToggled: acc.toggled(checked)+ onToggled: checked => acc.toggled(checked)}// .chev rotates 90 degrees when the card is open.diff --git a/scripts/moonlight/make-beta.py b/scripts/moonlight/make-beta.pyindex 732343c3..a2a55ee1 100644--- a/scripts/moonlight/make-beta.py+++ b/scripts/moonlight/make-beta.py@@ -90,7 +90,8 @@ if problems:raise SystemExit(1)with zipfile.ZipFile(zpath, 'w', zipfile.ZIP_DEFLATED, compresslevel=6) as z:- for f in files + [{'path': 'package-manifest.json'}]:+ # The base's own manifest is in `files` already; the rewritten one goes in once.+ for f in [f for f in files if f['path'] != 'package-manifest.json'] + [{'path': 'package-manifest.json'}]:z.write(pkg / f['path'], Path(pkg.name) / f['path'])print('package', pkg, len(files), 'files; player sha256', new_hash)print('zip', zpath, zpath.stat().st_size)diff --git a/scripts/ui-check/capture-age.qml b/scripts/ui-check/capture-age.qmlnew file mode 100644index 00000000..ae7cbf26--- /dev/null+++ b/scripts/ui-check/capture-age.qml@@ -0,0 +1,25 @@++ // ---- capture smoke (scripts/ui-check/ui-check.py) ---------------------------------------+ // Connects the default capture device for 25 s: frames must keep arriving through+ // DirectShow and the driver frame-age line ([capture-driver-age]) must appear.+ Timer { interval: 150; running: true; repeat: true; onTriggered: veyra.logUi("uitest-tick", "") }+ Timer {+ interval: 250; running: true; repeat: true+ property int step: 0+ property int ticks: 0+ function log(text) { veyra.logUi("uitest", text) }+ onTriggered: { try {+ ++ticks+ if (step === 0 && ticks === 8) { dialogs.open("capture"); step = 1; ticks = 0; return }+ if (step === 1 && ticks === 16) {+ if (!veyra.startCaptureSession()) throw new Error("startCaptureSession refused")+ dialogs.close(); step = 2; ticks = 0; return+ }+ if (step === 2 && ticks === 20) { log("UITEST_SHOT capture-running"); log("UITEST_NOTE fps=" + veyra.captureFps.toFixed(1)); return }+ if (step === 2 && ticks === 100) {+ log("UITEST_NOTE fps=" + veyra.captureFps.toFixed(1) + " dropped=" + veyra.captureDropped)+ if (!(veyra.captureFps > 20)) throw new Error("capture frame rate " + veyra.captureFps)+ running = false; log("UITEST_DONE")+ }+ } catch (e) { running = false; log("UITEST_FAIL " + e.message) } }+ }diff --git a/src/engine/VideoPresenter.cpp b/src/engine/VideoPresenter.cppindex 10e1dade..2ca01abc 100644--- a/src/engine/VideoPresenter.cpp+++ b/src/engine/VideoPresenter.cpp@@ -110,7 +110,7 @@ bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing&// stretch current buffers there instead of repeatedly draining the GPU// and rebuilding provider resources at monitor/DPI boundaries.const bool windowChanging=GetPropW(window_,L"Veyra.InteractiveMove")||GetPropW(window_,L"Veyra.DpiTransition");- if(!windowChanging&&(targetWidth!=sink_.width()||targetHeight!=sink_.height())&&GetTickCount64()>=deferUntil&&now-lastResize_>=std::chrono::milliseconds(100)) {+ 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 olddiff --git a/src/gfx/PresentSink.cpp b/src/gfx/PresentSink.cppindex 126fb228..9db80830 100644--- a/src/gfx/PresentSink.cpp+++ b/src/gfx/PresentSink.cpp@@ -209,12 +209,16 @@ bool PresentSink::initialize(ID3D12Device* device, ID3D12CommandQueue* queue,if (!swapChain_) {const auto createNative=[&](){HRESULT result=E_FAIL;- for(unsigned attempt=0;attempt<3;++attempt){+ // E_ACCESSDENIED: the window still has the previous swapchain. That is normally gone+ // within a frame or two, but an overlay that hooks presentation (GamePP in the field+ // log 2026-10-01) can hold it longer; wait up to ~1.3 s before failing the rebuild.+ constexpr unsigned attempts=8;+ for(unsigned attempt=0;attempt<attempts;++attempt){swapChain1.Reset();result=factory_->CreateSwapChainForHwnd(queue,hwnd_,&scd,nullptr,nullptr,&swapChain1);- if(result!=E_ACCESSDENIED||!IsWindow(hwnd_)||attempt==2)break;+ if(result!=E_ACCESSDENIED||!IsWindow(hwnd_)||attempt+1==attempts)break;log::warn("present",std::format("swapchain transient access denied attempt={}; bounded owner-thread retry",attempt+1));- Sleep(50);+ Sleep(std::min(50u*(attempt+1),300u));}return result;};@@ -459,10 +463,19 @@ bool PresentSink::waitForQueueIdle()return completed;}+bool PresentSink::resizeDue() const+{+ // After a failure, wait 0.2, 0.4 ... up to 3.2 s before the next attempt; the old+ // buffers keep presenting (stretched) meanwhile.+ return resizeFailures_ == 0 ||+ GetTickCount64() - lastResizeFailureMs_ >= (100ull << std::min<uint32_t>(resizeFailures_, 5));+}+void PresentSink::resize(uint32_t width, uint32_t height){if (width == 0 || height == 0) return;if (width == width_ && height == height_) return;+ if (!resizeDue()) return;diagnostics::CpuStallTrace trace("resize-stall");const UINT flags = swapChainFlags_;// DXGI spec compliance before ResizeBuffers: wait for outstanding GPU@@ -475,11 +488,18 @@ void PresentSink::resize(uint32_t width, uint32_t height)desc_.hdr10?DXGI_FORMAT_R10G10B10A2_UNORM:desc_.hdr?DXGI_FORMAT_R16G16B16A16_FLOAT:DXGI_FORMAT_R8G8B8A8_UNORM, flags);trace.mark("resizeBuffers");if (FAILED(hr)) {- log::error("present", std::format("ResizeBuffers FAILED hr=0x{:X} (queue idle, buffers released)",- static_cast<unsigned>(hr)));+ ++resizeFailures_;+ lastResizeFailureMs_ = GetTickCount64();+ // DXGI_ERROR_INVALID_CALL with our own references released means another module+ // still holds a back buffer: an overlay or capture hook in this process.+ if (resizeFailures_ <= 3 || (resizeFailures_ & (resizeFailures_ - 1)) == 0)+ log::error("present", std::format("ResizeBuffers FAILED hr=0x{:X} (queue idle, buffers released; failures in a row={}; "+ "an injected overlay/capture hook can hold the buffers)", static_cast<unsigned>(hr), resizeFailures_));refetchBackBuffers();return;}+ if (resizeFailures_ > 0) log::info("present", std::format("ResizeBuffers recovered after {} failures", resizeFailures_));+ resizeFailures_ = 0;if (!refetchBackBuffers()) return;trace.mark("refetchBuffers");width_ = width;diff --git a/src/source/CaptureCardSource.cpp b/src/source/CaptureCardSource.cppindex 7e71a4e1..3acc233c 100644--- a/src/source/CaptureCardSource.cpp+++ b/src/source/CaptureCardSource.cpp@@ -374,9 +374,35 @@ struct CaptureCardSource::Impl:ISampleGrabberCB {std::unique_ptr<magewell::LowLatencyVideo> magewell;magewell::VideoRequest magewellRequest;bool magewellWanted=false;std::atomic<bool> magewellDelivering{false}; // set after start, cleared before stop+ std::atomic<uint64_t> externalFrames{0};+ // DirectShow keeps capturing while the SDK runs unless the graph is stopped. Two 4K60+ // P010 DMA streams (~1.5 GB/s each) exceed a Pro Capture card's PCIe link: both fell to+ // ~28 fps and the SDK frames took 42-49 ms to land (field log 2026-10-01). The graph+ // is stopped once the SDK has delivered, when no DirectShow audio shares it.+ bool magewellCanPauseGraph=false,directShowPaused=false;+ // How old a frame already is, by the driver's own timestamp, when DirectShow hands it to+ // us: graph clock now - (run reference + sample start). Anything the driver queued+ // shows up here and nowhere else (some GC573 users report high latency, others not).+ // The run reference is read just before Run, so the value can read a few ms high.+ ComPtr<IReferenceClock> ageClock;REFERENCE_TIME runReference=0;std::vector<double> driverAges;+ void observeDriverAge(REFERENCE_TIME sampleStart){+ if(!ageClock||runReference<=0)return;+ REFERENCE_TIME now=0;if(FAILED(ageClock->GetTime(&now)))return;+ const double ms=double(now-runReference-sampleStart)/10000.0;+ if(!std::isfinite(ms)||ms<-1000||ms>10000)return;+ driverAges.push_back(ms);+ if(driverAges.size()<600)return;+ auto sorted=driverAges;std::sort(sorted.begin(),sorted.end());+ log::info("capture-driver-age",std::format("frames={} p50Ms={:.1f} p95Ms={:.1f} minMs={:.1f} maxMs={:.1f} driverBuffers={} "+ "(driver timestamp -> our callback; includes one frame if the driver stamps the frame start; ~few ms high)",+ sorted.size(),sorted[sorted.size()/2],sorted[sorted.size()*95/100],sorted.front(),sorted.back(),driverBuffers));+ driverAges.clear();+ }+ long driverBuffers=0;bool externalTimeAnchored=false;double externalTimeOffset=0;void deliverExternal(const uint8_t* data,size_t bytes,double deviceSeconds,bool discontinuity){const auto arrival=Clock::now();+ externalFrames.fetch_add(1,std::memory_order_relaxed);AVFrame* staged=nullptr;bool written=false;{std::lock_guard lock(mutex);if(stagingFrame&&!stagingBusy){stagingBusy=true;staged=stagingFrame;}}if(staged)written=writeCaptureFrame(layout,data,bytes,*staged,verticalFlip.load());@@ -532,6 +558,7 @@ struct CaptureCardSource::Impl:ISampleGrabberCB {const auto arrival=Clock::now();BYTE* data=nullptr;REFERENCE_TIME sampleStart=0,sampleEnd=0;const bool sampleTime=sample&&sample->GetTime(&sampleStart,&sampleEnd)==S_OK;+ if(sampleTime&&!compressedPath)observeDriverAge(sampleStart);const bool valid=sample&&std::isfinite(time)&&SUCCEEDED(sample->GetPointer(&data))&&data&&(compressedPath?sample->GetActualDataLength()>0:sample->GetActualDataLength()>=LONG(layout.sampleBytes));bool enqueued=false;uint64_t timingSequence=0;int64_t copied100ns=0;double lockWaitMs=0,arrivalDeltaMs=0,ptsDeltaMs=0;@@ -845,6 +872,7 @@ bool CaptureCardSource::configure(const SourceOpenDesc& desc){close();error_.cleconst auto allocatorHr=queryCaptureAllocatorProperties(input.Get(),actual);const bool negotiated=suggestedBuffers>0;const bool honored=negotiated&&SUCCEEDED(allocatorHr)&&actual.cBuffers==suggestedBuffers;+ p.driverBuffers=SUCCEEDED(allocatorHr)?actual.cBuffers:0;log::info("capture-buffer",std::format("mode={} requested={} actual buffers={} bytes={} align={} hr=0x{:08X} {}",captureBufferModeKey(bufferPolicy),suggestedBuffers,actual.cBuffers,actual.cbBuffer,actual.cbAlign,uint32_t(allocatorHr),!negotiated?"(driver default)":honored?"(driver honored)":"(driver ignored; negotiation not applied)"));}log::info("capture",std::format("native ConnectDirect subtype=0x{:08X} hr=0x{:08X} converters=0",native->subtype.Data1,uint32_t(hr)));@@ -1371,16 +1399,29 @@ bool CaptureCardSource::start(){if(p.audioSession&&p.audioSessionDeferred)log::info("capture-audio-bitstream","audio session starts with the first decoded bitstream frame");else if(p.audioSession&&!p.audioSession->start())log::warn("capture-audio","audio start failed; retaining video capture");p.audioRecovery.reset(GetTickCount64());+ // Driver frame age (observeDriverAge): fix the graph clock now and note its time at Run.+ p.ageClock.Reset();p.runReference=0;p.driverAges.clear();+ {ComPtr<IFilterGraph> fg;ComPtr<IMediaFilter> mf;+ if(SUCCEEDED(p.graph.As(&fg))&&SUCCEEDED(p.graph.As(&mf))){+ if(!p.referenceClock)fg->SetDefaultSyncSource();+ if(SUCCEEDED(mf->GetSyncSource(&p.ageClock))&&p.ageClock&&FAILED(p.ageClock->GetTime(&p.runReference)))p.runReference=0;}}p.lastFrame=Impl::Clock::now();const auto hr=p.control->Run();p.info.opened=SUCCEEDED(hr);if(p.info.opened&&p.wasapi&&!p.wasapi->start())p.audioError=L"WASAPI 音频启动失败;视频继续运行";if(p.info.opened&&p.magewellWanted){p.externalTimeAnchored=false;p.magewell=std::make_unique<magewell::LowLatencyVideo>();std::wstring why;+ p.externalFrames=0;p.directShowPaused=false;+ // Audio from a DirectShow device lives in the same graph and would stop with it.+ p.magewellCanPauseGraph=!p.audioSink&&!p.audioFilter&&!p.audioPassthrough;if(!p.magewell->start(p.magewellRequest,[&p](const uint8_t* data,size_t bytes,double t,bool d){p.deliverExternal(data,bytes,t,d);},why)){log::warn("magewell",std::format("low latency not started; DirectShow video continues ({})",narrowForLog(why)));p.magewell.reset();- }else p.magewellDelivering=true;+ }else{+ p.magewellDelivering=true;+ if(!p.magewellCanPauseGraph)log::warn("magewell","audio comes from a DirectShow device in the capture graph, so DirectShow video keeps running beside the SDK; "+ "choose the card's WASAPI audio endpoint for the full frame rate at 4K");+ }}veyra::log::info("capture",std::format("Run hr=0x{:X} actual={}x{} nominalFps={:.3f} mailbox=1 ownedBuffers=2",unsigned(hr),p.info.width,p.info.height,p.info.averageFps));return p.info.opened;}@@ -1452,6 +1493,19 @@ CaptureMetrics CaptureCardSource::metrics()const{SourceReadStatus CaptureCardSource::read(pipeline::FramePacket& packet,const AVFrame** frame){return readWithWait(packet,frame,30);}SourceReadStatus CaptureCardSource::tryRead(pipeline::FramePacket& packet,const AVFrame** frame){return readWithWait(packet,frame,0);}SourceReadStatus CaptureCardSource::readWithWait(pipeline::FramePacket& packet,const AVFrame** frame,unsigned milliseconds){auto& p=*p_;*frame=nullptr;if(!p.info.opened)return SourceReadStatus::Error;+ // Magewell: stop DirectShow video once the SDK has proved itself (30 frames), and run+ // it again if the SDK thread ends, so video never stops altogether.+ if(p.magewellDelivering.load()&&p.control){+ const bool sdk=p.magewell&&p.magewell->running();+ if(sdk&&!p.directShowPaused&&p.magewellCanPauseGraph&&p.externalFrames.load(std::memory_order_relaxed)>=30){+ const HRESULT hr=p.control->Stop();p.directShowPaused=SUCCEEDED(hr);+ log::info("magewell",std::format("DirectShow video stopped while the SDK delivers (frees the card's DMA bandwidth) hr=0x{:08X}",uint32_t(hr)));+ }else if(!sdk&&p.directShowPaused){+ const HRESULT hr=p.control->Run();p.directShowPaused=false;+ {std::lock_guard lock(p.mutex);p.forceDiscontinuity=true;}+ log::warn("magewell",std::format("SDK capture ended; DirectShow video resumed hr=0x{:08X}",uint32_t(hr)));+ }+ }long code=0;LONG_PTR a=0,b=0;while(p.events&&p.events->GetEvent(&code,&a,&b,0)==S_OK){if(code==EC_DEVICE_LOST||code==EC_ERRORABORT)log::warn("capture-reconnect",std::format("DirectShow event={} detail=0x{:X}",code,uint64_t(a)));p.events->FreeEventParams(code,a,b);if(code==EC_DEVICE_LOST||code==EC_ERRORABORT)return SourceReadStatus::Error;}double time=0;uint32_t flags=0;uint64_t sequence=0;pipeline::Rational duration;AVFrame* delivered=nullptr;AVFrame* expiredHardware=nullptr;bool feedDecode=false;{@@ -1511,7 +1565,7 @@ void CaptureCardSource::close()noexcept{p.averMediaSwitch.stop();p.embeddedAudioUnavailable=false;if(p.audioSession)p.audioSession->stop();p.audioError.clear();if(p.audioPassthrough)p.audioPassthrough->close();- p.events.Reset();p.control.Reset();p.grab.Reset();p.nullFilter.Reset();p.grabFilter.Reset();p.audioSink.Reset();p.audioFilter.Reset();p.config.Reset();p.device.Reset();p.builder.Reset();p.graph.Reset();p.referenceClock.Reset();p.audioSession.reset();p.audioPassthrough.reset();+ p.events.Reset();p.control.Reset();p.grab.Reset();p.nullFilter.Reset();p.grabFilter.Reset();p.audioSink.Reset();p.audioFilter.Reset();p.config.Reset();p.device.Reset();p.builder.Reset();p.graph.Reset();p.referenceClock.Reset();p.ageClock.Reset();p.runReference=0;p.audioSession.reset();p.audioPassthrough.reset();if(p.decodeThread.joinable()){{std::lock_guard lock(p.mutex);p.decodeStop=true;p.compressedQueue.clear();p.payloadPool.clear();}p.decodeWake.notify_all();p.decodeThread.join();}for(auto& thread:p.extraDecodeThreads)if(thread.joinable())thread.join();p.extraDecodeThreads.clear();p.extraDecoders.clear();p.mjpegParallel=false;diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cppindex d1e2204e..d112d9e8 100644--- a/src/ui/QmlPlayerBridge.cpp+++ b/src/ui/QmlPlayerBridge.cpp@@ -835,6 +835,35 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesyst});impl_->timer->start(16);startGpuSampler();+ // Overlays that hook presentation get injected into this process when a D3D device+ // appears (Qt's at start, the engine's at open). Field log 2026-10-01: with GamePP's+ // modules loaded, both the video swapchain and Qt's own failed every resize, a+ // settings rebuild could not recreate the swapchain, and the driver crashed on a+ // window change. Look for them for two minutes and say so once.+ auto* hookTimer = new QTimer(this);+ connect(hookTimer, &QTimer::timeout, this, [this, hookTimer, started = GetTickCount64()] {+ struct Hook { const wchar_t* module; const char* product; bool warn; };+ static const Hook hooks[] = {+ {L"GPP64.dll", "GamePP", true}, {L"shade64.dll", "GamePP", true}, {L"GameTracker64.dll", "GamePP", true},+ {L"RTSSHooks64.dll", "RivaTuner Statistics Server", false}, {L"graphics-hook64.dll", "OBS game capture", false},+ {L"DiscordHook64.dll", "Discord overlay", false}, {L"gameoverlayrenderer64.dll", "Steam overlay", false},+ };+ static bool seen[std::size(hooks)]{};+ static bool warned = false;+ for (size_t k = 0; k < std::size(hooks); ++k) {+ if (seen[k] || !GetModuleHandleW(hooks[k].module)) continue;+ seen[k] = true;+ veyra::log::warn("overlay-hooks", std::format("{} is injected into this process ({}); it hooks presentation and can "+ "hold swapchain buffers", hooks[k].product, QString::fromWCharArray(hooks[k].module).toStdString()));+ if (hooks[k].warn && !warned) {+ warned = true;+ emit notice(tr("检测到游加加(GamePP)注入了本程序。它会钩住画面输出,可能导致改窗口大小、全屏、改设置时画面异常或崩溃。"+ "请在游加加里关闭对 Veyra 的帧数显示 / 滤镜,或退出游加加后再用。"), true);+ }+ }+ if (GetTickCount64() - started > 120000) hookTimer->stop();+ });+ hookTimer->start(5000);}QmlPlayerBridge::~QmlPlayerBridge() {