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 Xbox nullable signaling and contain sustained fullscreen VRAM growth
Veyra Goal Agent6363c0dec3bb
diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.mdindex 2a519c95..439bb624 100644--- a/docs/CURRENT_STATUS.md+++ b/docs/CURRENT_STATUS.md@@ -1,5 +1,9 @@# 当前项目状态 / Current Status+## 2026-10-02 2.0.1 接管候选(尚未发布)++Claude 的 `8f42fd5` 已在 nrvideo/main,2.0.1 tag/Release 未创建。当前修复在 `codex/field-2.0.1-20261002` 的 E 盘隔离 worktree,README 不动。Xbox 空值/等待/错误码/ICE 解析已修,80 项协议/本地 WebRTC 验证通过;显存做持续全屏增长退出全屏的应急保护,补帧开/关故障注入均通过,**5060 Ti 4K 全屏泄漏根因与真实现场结果未确认,不能称为彻底修好**。本地 5070 加载相同插件时仍稳定,不能只凭插件加载归因。用户授权修好后发布;先保持未发布,候选待反馈者验证。完整接管记录 `FIELD_2.0.1_REPAIR_PLAN_2026-10-02.md`,历史状态不覆盖本节。+## 2026-10-02 2.0.0 发布更新用户已确认 OBS 兼容并授权发布 GitHub 2.0.0、更新中英文 README 和新版操作教程。当前发布内容以 README、RELEASE_NOTES_2.0.0.md、BUILD_2.0.0.md 及 RELEASE_2.0.0_PUBLIC_2026-10-02.md 为准。以下未发布/未授权等旧阶段表述保留作历史,不覆盖本次授权;硬件未验边界仍保留。diff --git a/docs/FIELD_2.0.1_REPAIR_PLAN_2026-10-02.md b/docs/FIELD_2.0.1_REPAIR_PLAN_2026-10-02.mdnew file mode 100644index 00000000..33bb748b--- /dev/null+++ b/docs/FIELD_2.0.1_REPAIR_PLAN_2026-10-02.md@@ -0,0 +1,28 @@+# 2.0.1 field repair and release handoff — 2026-10-02++The current user authorises taking over Claude's work, investigating the two VRAM logs (8 / 12) and Xbox log 11, fixing them before publication, then publishing 2.0.1 according to the conversation with Claude. Read the actual local transcript b667394c-e878-4628-ae05-663760b1a66b: README and README_EN remain byte-identical; Release retains the complete 2.0.0 changes, Chinese followed by English, plus the new fixes, and both 220 px support QR images. Runtime identities remain the 2.0.0 publisher lock. This specific bug repair replaces the old UI-only freeze for necessary repair paths; it does not authorise unrelated changes, driver/profile modifications, proprietary binary changes or sub-agents.++Claude's final commit 8f42fd51475950057050ce1763f0f3cddd311730 is already on nrvideo/main. No v2.0.1 release/tag existed at takeover. Its package is retained as an earlier candidate, not published. GPU-reset export recovery has evidence in RELEASE_2.0.1_2026-10-02.md; Xbox and VRAM were still unresolved there. Desktop checkout and existing worktrees stay intact.++Isolation: branch codex/field-2.0.1-20261002, worktree E:/项目/Veyra/worktrees/field-2.0.1-20261002. Checkpoint checkpoint/pre-field-2.0.1-20261002. Immutable source hashes and input log identities: E:/项目/Veyra/archives/field-2.0.1-20261002. All new build/tests/logs/TEMP use E:/项目/Veyra/<purpose>/field-2.0.1-20261002. Test <=300 seconds, build <=900 seconds.++1. Xbox: reproduce original null error fields with a successful SDP response; cover success, actual refusal including numeric error codes, pending response and timeout. Compare fixed upstream protocol, keep actual errors distinct from network failures. Run the product protocol tests including real local WebRTC, without using the user's account/console or claiming real-console acceptance.+2. VRAM: derive the usage timeline relative to fullscreen and settings, audit resource ownership and presentation. Loaded nvppex.dll is correlation, not proof of cause. Reproduce on available hardware with effect-off, NR, FG and fullscreen transitions; do not turn an unobserved leak into a claim of repair. If recovery/containment is necessary, it must be explicit, bounded and tested and must not silently alter quality or driver settings.+3. Run appropriate regression against the final candidate (QML, existing hotfixes, export recovery). Preserve patched FFmpeg and all runtime identities. Inspect actual generated package, manifest, clean-path startup and source snapshots.+4. Publish only once the code repair and relevant validation are complete. Release notes accurately distinguish confirmed fixes, containment and unverified field results. Merge/push/tag/publication are authorised by the current user request; no second approval is needed. Verify uploaded hashes, body and QR URLs. Do not label the two field issues fixed merely because more logs were added.++Status: Xbox client parsing repaired and regression-tested; fullscreen VRAM containment implemented and injection-tested with FG off/on. The field leak itself is still unconfirmed on the final candidate. Publication remains pending that result, not pending another permission request.++Repair dependency: PlayerUiFacade.cpp must compare the VRAM warning/fallback fields so an asynchronous memory warning reaches QML even when other readouts remain unchanged. This is included in the field guard; the archived baseline remains immutable. A bounded exit from fullscreen is containment, not evidence of a cured allocation leak. Keep 2.0.1 unpublished while field verification is outstanding.++## Evidence and limits++- Xbox log 11 fails during SDP exchange with nlohmann's string/null type error. That exception does not prove a console refusal: a successful wrapper may contain `errorDetails.code/message = null`. The original pre-hotfix code used string `value()` on these fields. Claude's first null-safe fix already accepts that success, but four new regressions still failed on 8f42fd5: pending 200/202 wrappers, numeric errors, timeout misclassification, and nullable ICE metadata. All now pass. Numeric errors remain errors, not forced success; pending responses keep the original 40-attempt bound.+- `build-xbox-regression-before.log` and `xbox-regression-before.log`: new test binary built, 80 checks / 4 failures. `build-xbox-fix.log`, `xbox-regression-after.log`: 80 / 0, including real loopback ICE/DTLS/SCTP, handshake, H264 and Opus RTP. No Microsoft-account or real-console operation performed.+- Original log 12 grows to 21184 MiB against a roughly 14521 MiB budget. Rebuild results of -148 / -225 MiB mean usage increased; they are not reclaimed memory. Exiting fullscreen stops further growth but does not return the retained memory. Driver 616.92, 4K display / 225% scale; local 5070 is driver 616.56, 1440p display / 100% scale. These are material differences, not proof of a driver defect.+- Before containment: actual 4K file, NR/FG off, 40 s windowed / 120 s fullscreen / 40 s windowed: 1183 / 1251 / 1184 MiB; NVIDIA `nvppex.dll` loaded, no sustained growth. Actual USB 1440p60 NV12 capture, NR on: 90 s fullscreen without FG around 1369 MiB, 100 s with DLSS 2X around 1895 MiB, steady 60 source completions/s. Cannot extend this to the user's 5060 Ti/4K configuration.+- Containment waits ten seconds after a settings change, detects growth above max(512 MiB, min(2 GiB, budget/8)) on three samples, publishes an unsafe-fullscreen state, and returns the same source/effects to windowed playback. Fullscreen stays blocked for that source session. No persistent settings or driver profiles change. No claim that held allocations are released or that fullscreen's allocation leak is fixed.+- `memory-off-v1` / `memory-on-v1`: final EXE SHA256 B9E862E5D9BEB5B339C1821D01D08033BB3B81BC52C51F8D21E2C2312353F5E2. Real capture/NR with explicitly injected 64 MiB/s allocations only in fullscreen. Both cases return to a window, keep NR and the requested FG state, reject re-entry, keep processing (+1575 / +1642 real frames), and remain stable at 2870 / 3426–3429 MiB after fallback. No repeated graph rebuild. This verifies the protection, not the field root cause.+- `regression-v2`: 243 repair checks, 80 Xbox checks, QML data migration, interface translations, 29 Qt Quick component/export checks passed. `regression-v1` missed the test-only image output directory and failed Qt Quick with no stderr logging; fixture corrected, no product change, complete second run passed. Existing mocked QML warnings about absent bridge members remain in the component harness; real app logs show the live bridge.++Paths: E:/项目/Veyra/build|tests|logs|tmp/field-2.0.1-20261002. Build commands use `field-2.0.1-build.py`; regression/memory commands use `field-2.0.1-tests.py`. Baseline live checks use `ui-check.py` and the committed fullscreen snippets. Candidate destination: E:/项目/Veyra/releases/2.0.1-field-20261002. Package/source audit and field feedback are kept there or under verify/field-2.0.1-20261002. README checks and the complete 2.0.0 Release suffix remain unchanged.diff --git a/docs/RELEASE_2.0.1_2026-10-02.md b/docs/RELEASE_2.0.1_2026-10-02.mdindex 4587d275..2c317290 100644--- a/docs/RELEASE_2.0.1_2026-10-02.md+++ b/docs/RELEASE_2.0.1_2026-10-02.md@@ -2,7 +2,13 @@用户要求:修 8K 导出失败、再查 Xbox("其他软件能串流上")、看爆显存有没有抓到,修好发 2.0.1;README 不动;Release 正文保留 2.0.0 全部内容并加上这次的修复。2.0.0 当晚的原地更新包内容见 `docs/HOTFIX_2.0.0_2026-10-02.md`,2.0.1 全部包含。-## 现场日志结论+## Codex 接管复核(当前)++当前授权要求日志 8/12 显存与日志 11 Xbox 修复后再发布。`8f42fd5` 的显存改动只做诊断/归因提示,未解决增长;Xbox null 异常也不能证明主机拒绝成功协商。已修 Xbox 正常空字段、未完成应答轮询、数字错误码与 nullable ICE,并去掉通用 UDP 归因;80 项协议/真实本地 WebRTC 检查通过,反馈者主机待确认。++显存原日志负数“released”实际代表增长;本机同样加载 `nvppex` 时仍稳定,模块加载不足以确认因果。新增应急保护:设置稳定后持续全屏增长就退回窗口继续原片源/增强,当前会话禁止再次全屏。补帧开/关故障注入已验,**不等于修复分配泄漏根因**。4K 文件与本机 1440p60 采集短测未复现,用户 5060 Ti 的 4K/225%/616.92 配置尚未验。详细证据、源码隔离与产物路径见 `FIELD_2.0.1_REPAIR_PLAN_2026-10-02.md`。当前先出候选,不发布、不把诊断冒充修复。++## Claude 阶段判断(保留历史,以接管复核为准)| 日志 | 结论 ||---|---|diff --git a/docs/RELEASE_NOTES_2.0.1.md b/docs/RELEASE_NOTES_2.0.1.mdindex 755ac8da..524521de 100644--- a/docs/RELEASE_NOTES_2.0.1.md+++ b/docs/RELEASE_NOTES_2.0.1.md@@ -6,9 +6,9 @@### 2.0.1 修复-- **导出时显卡被系统重置,不再整段作废**:8K、长视频开 NR 导出时,40 系显卡偶发驱动卡死并被 Windows 重置(社区版 NR 运行库在 Ada 上的已知问题)。现在已导出的部分会自动保存,新开一个导出进程从断点接着导,最后无损拼接成一个文件,不重新编码;最多续 3 次。注意:这让导出能扛过重置,重置本身仍会发生,画面会在重置那一刻停一下。-- **全屏时显存一直涨**:现场日志显示,只在全屏时涨、退出全屏就停,Veyra 重建显示链和处理链都释放不了;同时进程里都有 NVIDIA App 的画面插件(RTX HDR / 智能平滑运动 / RTX 动态鲜艳度)。现在检测到它时会直接提示到 NVIDIA App → 图形 → 程序设置里为 Veyra 关闭这几项,不再做无效的重建(之前每次都会让画面闪一下)。-- **Xbox 串流连不上时看不到原因**:主机回复里的空字段让程序先报错,把主机给出的拒绝原因盖住了。现在会显示主机的原因,并在日志里记录完整的连接协商内容,方便对照能连上的客户端排查。+- **导出时显卡被系统重置,不再整段作废**:8K、长视频开 NR 导出时,有 40 系用户遇到驱动卡死并被 Windows 重置。现在已导出的部分会自动保存,新开一个导出进程从断点接着导,最后无损拼接成一个文件,不重新编码;最多续 3 次。这是重置后的恢复,不代表驱动挂起根因已修复;已用模拟设备移除验证续导,8K 反馈者实机结果待确认。+- **全屏显存异常增长保护**:设置稳定后检测持续增长,自动退出全屏并在本次播放中限制再次进入,保持片源、NR 和补帧设置,用窗口继续播放,避免原先反复重建却继续增长。已分配的异常显存不保证释放,重新开程序可重测。**这是应急保护,5060 Ti 的 4K 全屏泄漏根因尚未确认、现场结果待验证**;本机加载同一 NVIDIA 插件也能稳定播放,不能仅凭模块出现就认定它是原因。设置中的 OBS 游戏采集兼容可用于切换界面显示路径后重测。+- **Xbox 空值应答导致协商中断**:成功应答里的 `null` 错误字段不会再触发字符串异常;HTTP 200/202 的未完成应答继续有限轮询,数字错误码保留,空 ICE 元数据不会再次中断连接。协商失败显示实际阶段,不再一律提示 UDP 被拦截。本机 80 项协议/本地 WebRTC 测试通过,反馈者真实 Xbox 连接结果待确认。- 以下几项已在 2.0.0 的更新包里修过,2.0.1 一并包含:- 输出稳定器·抗闪烁打开再关闭后画面定住;- 首页"继续上次"的采集卡没有声音;@@ -23,9 +23,9 @@### 2.0.1 fixes-- **An export survives a GPU reset**: 8K and long exports with NR occasionally hung the driver on RTX 40 cards and Windows reset the GPU (a known issue of the community NR runtimes on Ada), losing the whole file. The part already exported is now kept, a fresh export process continues from that point, and the parts are joined into one file without re-encoding (up to three resets). The reset itself still happens; this makes the export survive it.-- **Video memory kept growing in fullscreen**: field logs grew only in fullscreen, stopped when leaving it, and neither a swapchain nor a pipeline rebuild released any of it, always with NVIDIA App's picture plug-in (RTX HDR / Smooth Motion / RTX Dynamic Vibrance) loaded. Veyra now names it and points to NVIDIA App → Graphics → Program Settings, instead of rebuilding in vain (each rebuild flashed the picture).-- **Xbox connection failures hid the reason**: a null field in the console's reply raised an error first. The console's reason is now shown, and the whole negotiation is logged for comparison with a client that connects.+- **An export survives a GPU reset**: some RTX 40 users encountered driver hangs/resets during 8K or long NR exports. Completed parts are kept, a fresh export process resumes, and parts are joined without re-encoding (up to three resets). Recovery was tested with injected device removal; the original driver's hang and the reporting user's 8K result remain unverified.+- **Protection against sustained fullscreen VRAM growth**: after settings settle, sustained growth makes Veyra return to windowed playback and restrict fullscreen re-entry for that source session, keeping the source, NR and frame generation settings. It avoids repeated rebuilds that do not reclaim memory. Retained memory may require restarting Veyra. **This is containment; the RTX 5060 Ti 4K fullscreen leak and its field outcome remain unconfirmed.** The same NVIDIA plug-in is present in stable local playback, so its presence alone does not establish the cause. OBS game capture compatibility in Settings provides another UI display path for testing.+- **Xbox nullable replies interrupted negotiation**: null error fields in successful responses are accepted; pending HTTP 200/202 wrappers are polled within a bounded budget; numeric service errors are preserved; nullable ICE metadata no longer aborts connection setup. Failures report their actual stage rather than always blaming blocked UDP. All 80 local protocol/WebRTC checks passed; the reporting user's real-console connection still needs confirmation.- Already in the refreshed 2.0.0 package and included here: the picture froze after turning the output stabiliser (anti-flicker) on and off; "Continue" on a capture card had no sound; the load gauge counted one of several NR layers; colour Texture / Clarity / Dehaze had no effect; clicking the taskbar button did not minimise; when the GPU device is lost or Veyra crashes as a capture starts with NVIDIA App's plug-in or RTSS injected, Veyra says where to turn them off.Corresponding source: `Veyra-2.0.1-source.zip`; third-party dependency sources are unchanged from 2.0.0 and `Veyra-2.0.0-dependency-source.zip` is attached to this Release too. Runtimes are unchanged.diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex 48963a7a..20068d73 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -1,5 +1,15 @@# Veyra 工作记录+## 2026-10-02 Codex 接管 2.0.1:Xbox 修复、显存保护候选++- 当前用户要求先处理日志 8/12 爆显存与日志 11 Xbox 连接失败,再按 Claude 对话发 2.0.1;发布授权已存在,不另问批准。已读取 Claude 本机原对话:README 不动,Release 保留 2.0.0 全部内容并追加修复,中英及双 220px 二维码保留。+- 在 `codex/field-2.0.1-20261002` / `E:/项目/Veyra/worktrees/field-2.0.1-20261002` 接续 `8f42fd5`;桌面脏工作区及 main 不动。存档标签 `checkpoint/pre-field-2.0.1-20261002`,原始文件/日志哈希在 archives/field-2.0.1-20261002;独立 scope guard 每次构建/测试运行,未修改旧 guard 或基线。+- Xbox:正常应答也可能带 null 错误字段,不能推断主机拒绝。补齐未完成 200/202 轮询、数字错误码、超时与 null ICE;新回归先 80 项/4 失败,修复后 80/0,包括真实本地 WebRTC 握手/媒体。错误提示保留实际协商阶段。真实反馈者主机尚未测试。+- 显存:本机有 `nvppex` 仍可稳定播放,不能把模块加载当因果证据。原日志重建后 −148/−225 MiB 是用量增加,不是释放。新增持续全屏增长退回窗口、当前片源禁止再次全屏的应急保护,增强设置和源继续;不是根因修复,未承诺异常分配被释放。+- 最终 EXE `B9E862E5D9BEB5B339C1821D01D08033BB3B81BC52C51F8D21E2C2312353F5E2`。真实 1440p60 采集/NR,故障注入补帧关/开均通过:退回窗口后显存 2870 / 3426–3429 MiB 稳定,继续完成 1575 / 1642 原帧,不重建图、不改变增强设置;本机 4K 文件及 1440p60 采集全屏短测未复现现场泄漏。+- `field-2.0.1-build.py` 各轮构建退出 0;`field-2.0.1-tests.py regression-v2`:243 repair、80 Xbox、29 Qt Quick、QML 数据/翻译通过。第一轮 Quick 夹具缺图片输出目录;修正夹具及 stderr,完整重跑通过,记录保留。+- 新产物统一 E:/项目/Veyra/build|tests|logs|tmp/field-2.0.1-20261002,候选包目录 releases/2.0.1-field-20261002。详情和命令/证据见 `docs/FIELD_2.0.1_REPAIR_PLAN_2026-10-02.md`。**当前未发布、未推送接管分支:显存根因/5060 Ti 现场结果仍缺,不能按“两个问题彻底修好”发布。** 询问用户是否能联系反馈者验证候选,继续先完成本地包与验收。+## 2026-10-02 夜 2.0.1- 用户授权发 2.0.1(README 不动,Release 正文保留 2.0.0 全部内容并加这次修复)。详情、现场日志结论与验证见 docs/RELEASE_2.0.1_2026-10-02.md。diff --git a/i18n/catalog.json b/i18n/catalog.jsonindex e2f2ac0b..bc4a7f98 100644--- a/i18n/catalog.json+++ b/i18n/catalog.json@@ -13189,6 +13189,34 @@"zh-TW": ";本次匯出使用 AMD FSR 超解析","en": "; this export uses AMD FSR super resolution","ja": ";今回の書き出しは AMD FSR 超解像を使用します"+ },+ {+ "zh": "全屏期间显存持续增长了 %1 GB,已退出全屏保护播放;当前会话使用窗口播放。增强设置保留。原因尚未确认,可开启设置中的 OBS 游戏采集兼容、重启后测试全屏。",+ "src": "src/ui/QmlPlayerBridge.cpp",+ "zh-TW": "全螢幕期間顯示記憶體持續增加了 %1 GB,已退出全螢幕保護播放;目前工作階段使用視窗播放。增強設定保留。原因尚未確認,可開啟設定中的 OBS 遊戲擷取相容、重新啟動後測試全螢幕。",+ "en": "VRAM kept growing by %1 GB in fullscreen. Playback has returned to a window for this session, keeping enhancement settings. The cause is unconfirmed. You can enable OBS game capture compatibility in Settings, restart, and test fullscreen again.",+ "ja": "全画面中に VRAM が %1 GB 増え続けたため、この再生はウィンドウ表示に戻りました。映像処理の設定は維持します。原因は未確認です。設定で OBS ゲームキャプチャ互換を有効にし、再起動して全画面を再テストできます。"+ },+ {+ "zh": "显存在设置未变时增加了 %1 GB,正在尝试回收;回收结果见诊断日志。原因尚未确认。",+ "src": "src/ui/QmlPlayerBridge.cpp",+ "zh-TW": "顯示記憶體在設定未變時增加了 %1 GB,正在嘗試回收;回收結果請見診斷日誌。原因尚未確認。",+ "en": "VRAM grew by %1 GB without a settings change. Recovery is being attempted; see the diagnostic log for the result. The cause is unconfirmed.",+ "ja": "設定を変えていないのに VRAM が %1 GB 増加したため、回収を試みています。結果は診断ログをご覧ください。原因は未確認です。"+ },+ {+ "zh": "本次播放检测到全屏显存持续增长,请使用窗口播放;重新打开片源后可再次测试全屏。",+ "src": "qml/Veyra/Main.qml",+ "zh-TW": "本次播放偵測到全螢幕顯示記憶體持續增加,請使用視窗播放;重新開啟來源後可再次測試全螢幕。",+ "en": "VRAM kept growing in fullscreen during this session. Use windowed playback; reopen the source to test fullscreen again.",+ "ja": "この再生では全画面中に VRAM が増え続けました。ウィンドウ表示を使用してください。ソースを開き直すと全画面を再テストできます。"+ },+ {+ "zh": "Xbox 连接失败:{}",+ "src": "src/source/XboxSessionSource.cpp",+ "zh-TW": "Xbox 連線失敗:{}",+ "en": "Xbox connection failed: {}",+ "ja": "Xbox 接続失敗:{}"}]}diff --git a/include/veyra/engine/EngineController.h b/include/veyra/engine/EngineController.hindex 9ebd7414..0193110a 100644--- a/include/veyra/engine/EngineController.h+++ b/include/veyra/engine/EngineController.h@@ -55,6 +55,9 @@ struct PlayerSnapshot {// Video memory that kept growing with no settings change (MiB above the session's low point),// 0 until the watchdog fires. Field logs 2026-10-01: +3 GB a minute in fullscreen only.uint64_t vramRunawayMiB=0;+ // Fullscreen-only sustained growth: the UI exits fullscreen and blocks it+ // for this source session. It does not change effects or driver settings.+ bool vramFullscreenUnsafe=false;// Known injected components loaded when the growth was seen (gfx::riskyInjections).std::wstring vramInjected;std::wstring status=L"请打开视频或图片";diff --git a/include/veyra/ui/QmlPlayerBridge.h b/include/veyra/ui/QmlPlayerBridge.hindex 79358fa5..3a53d141 100644--- a/include/veyra/ui/QmlPlayerBridge.h+++ b/include/veyra/ui/QmlPlayerBridge.h@@ -52,6 +52,7 @@ class QmlPlayerBridge : public QObject {// a display rate is only real if the system display event can be read - the// design requires exactly this distinction rather than reusing submit FPS).Q_PROPERTY(QString outputSummary READ outputSummary NOTIFY snapshotChanged)+ Q_PROPERTY(bool fullscreenMemorySafe READ fullscreenMemorySafe NOTIFY snapshotChanged)Q_PROPERTY(double displayFps READ displayFps NOTIFY snapshotChanged)Q_PROPERTY(bool displayFpsKnown READ displayFpsKnown NOTIFY snapshotChanged)Q_PROPERTY(double queuedFrames READ queuedFrames NOTIFY snapshotChanged)@@ -752,6 +753,7 @@ public:int displaySync() const;void setDisplaySync(int value);Q_INVOKABLE void setPresentationFullscreen(bool value);+ bool fullscreenMemorySafe() const;int outputRateMode() const;void setOutputRateMode(int value);double outputCustomFps() const;diff --git a/qml/Veyra/Main.qml b/qml/Veyra/Main.qmlindex 5413243d..6b81ca18 100644--- a/qml/Veyra/Main.qml+++ b/qml/Veyra/Main.qml@@ -388,6 +388,11 @@ Window {videoHost.syncRect()}function toggleFullscreen() {+ if (!fullscreen && veyra.fullscreenMemorySafe === false) {+ toast.show(qsTr("本次播放检测到全屏显存持续增长,请使用窗口播放;重新打开片源后可再次测试全屏。"), true)+ veyra.logUi("ui-fullscreen", "blocked after sustained video-memory growth")+ return+ }fullLocked = falsefullTarget = !fullscreenvisibility = fullTarget ? Window.FullScreen : Window.Windowed@@ -648,6 +653,7 @@ Window {Connections {target: veyrafunction onSnapshotChanged() {+ if (root.fullscreen && veyra.fullscreenMemorySafe === false) root.toggleFullscreen()if (root.testAspect > 0) returnif (veyra.previewAspect > 0.2 && Math.abs(veyra.previewAspect - root.filmAspect) > 0.02)root.fitToFilm(veyra.previewAspect)diff --git a/scripts/acceptance/field-2.0.1-build.py b/scripts/acceptance/field-2.0.1-build.pynew file mode 100644index 00000000..c829e487--- /dev/null+++ b/scripts/acceptance/field-2.0.1-build.py@@ -0,0 +1,45 @@+"""Bounded isolated build with the current product's validated dependency paths."""+import os+import subprocess+import sys+from pathlib import Path++ROOT = Path(__file__).resolve().parents[2]+BASE = Path('E:/项目/Veyra')+TASK = 'field-2.0.1-20261002'+BUILD, TMP, LOGS = (BASE / part / TASK for part in ('build', 'tmp', 'logs'))+CONTROL = ROOT / 'scripts/acceptance/field-2.0.1-control.py'+subprocess.run([sys.executable, '-B', str(CONTROL)], check=True)+for p in (BUILD, TMP, LOGS):+ p.mkdir(parents=True, exist_ok=True)+settings = []+for line in (BASE / 'build/main-merge-20261002/CMakeCache.txt').read_text(encoding='utf8').splitlines():+ if ':' not in line or '=' not in line or line.startswith(('#', '//')):+ continue+ keytype, value = line.split('=', 1)+ key, kind = keytype.split(':', 1)+ if kind in ('INTERNAL', 'STATIC'):+ continue+ if key.startswith('VEYRA_') or key in ('CMAKE_PREFIX_PATH', 'CMAKE_MAKE_PROGRAM', 'PROTOC', 'PKG_CONFIG_EXECUTABLE'):+ settings.append(f'set({key} [[{value}]] CACHE {kind} "Existing product dependency" FORCE)')+(TMP / 'dependencies.cmake').write_text('\n'.join(settings), encoding='utf8')+targets = sys.argv[2:] or ['veyra_qml_ui', 'veyra_xbox_tests']+if any(not t.replace('_', '').isalnum() for t in targets):+ raise SystemExit('Invalid target')+cmd = TMP / 'build.cmd'+cmd.write_text('@echo off\nchcp 65001 >nul\ncall "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat" >nul 2>&1\nif errorlevel 1 exit /b 4\n"%TASK_CMAKE%" --preset x64-release -S "%TASK_ROOT%" -B "%TASK_BUILD%" -C "%TASK_TMP%\\dependencies.cmake"\nif errorlevel 1 exit /b 5\n"%TASK_CMAKE%" --build "%TASK_BUILD%" --parallel 6 --target ' + ' '.join(targets) + '\nexit /b %errorlevel%\n', encoding='ascii')+env = os.environ.copy()+env.update(VSLANG='1033', TASK_ROOT=str(ROOT), TASK_BUILD=str(BUILD), TASK_TMP=str(TMP),+ TEMP=str(TMP), TMP=str(TMP),+ TASK_CMAKE='C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe')+log = LOGS / sys.argv[1]+with log.open('x', encoding='utf8') as output:+ try:+ result = subprocess.run(['cmd.exe', '/d', '/c', str(cmd)], cwd=ROOT, env=env,+ stdout=output, stderr=subprocess.STDOUT, timeout=890).returncode+ except subprocess.TimeoutExpired:+ result = 124+print('BUILD', result, log)+print('\n'.join(log.read_text(encoding='utf8', errors='replace').splitlines()[-25:]))+subprocess.run([sys.executable, '-B', str(CONTROL)], check=True)+raise SystemExit(result)diff --git a/scripts/acceptance/field-2.0.1-control.py b/scripts/acceptance/field-2.0.1-control.pynew file mode 100644index 00000000..2876f00b--- /dev/null+++ b/scripts/acceptance/field-2.0.1-control.py@@ -0,0 +1,36 @@+"""Guard this field repair against an immutable, external source baseline."""+import hashlib+import json+import subprocess+from pathlib import Path++ROOT = Path(__file__).resolve().parents[2]+BASELINE = Path('E:/项目/Veyra/archives/field-2.0.1-20261002/scope-baseline.json')+ALLOWED = {+ 'src/xbox/StreamApi.cpp', 'src/xbox/WebRtcSession.cpp',+ 'include/veyra/xbox/StreamApi.h', 'tests/xbox/XboxTests.cpp',+ 'src/source/XboxSessionSource.cpp',+ 'src/engine/EngineController.cpp', 'include/veyra/engine/EngineController.h',+ 'src/gfx/PresentSink.cpp', 'include/veyra/gfx/PresentSink.h',+ 'src/ui/QmlPlayerBridge.cpp', 'include/veyra/ui/QmlPlayerBridge.h',+ 'src/ui/PlayerUiFacade.cpp',+ 'apps/veyra-qml/main.cpp', 'qml/Veyra/Main.qml',+ 'i18n/catalog.json', 'tests/unit/RepairContractTests.cpp',+ 'docs/WORKLOG.md', 'docs/CURRENT_STATUS.md', 'docs/THIRD_PARTY_NOTICES.md',+ 'THIRD_PARTY_NOTICES.md', 'docs/RELEASE_NOTES_2.0.1.md',+ 'docs/RELEASE_2.0.1_2026-10-02.md', 'docs/FIELD_2.0.1_REPAIR_PLAN_2026-10-02.md',+ 'scripts/acceptance/field-2.0.1-control.py', 'scripts/acceptance/field-2.0.1-build.py',+ 'scripts/acceptance/field-2.0.1-tests.py', 'scripts/ui-check/field-2.0.1-vram.qml',+}+baseline = json.loads(BASELINE.read_text(encoding='utf8'))+tracked = subprocess.check_output(['git', 'ls-files', '-z'], cwd=ROOT).decode().split('\0')+new = subprocess.check_output(['git', 'ls-files', '--others', '--exclude-standard', '-z'], cwd=ROOT).decode().split('\0')+current = {p: hashlib.sha256((ROOT / p).read_bytes()).hexdigest()+ for p in tracked + new if p and (ROOT / p).is_file()}+changed = {p for p in current.keys() | baseline['files'].keys()+ if current.get(p) != baseline['files'].get(p)}+unexpected = changed - ALLOWED+print('FIELD SCOPE', 'FAIL' if unexpected else 'PASS', len(changed), 'changed files')+if unexpected:+ print('\n'.join(sorted(unexpected)))+raise SystemExit(bool(unexpected))diff --git a/scripts/acceptance/field-2.0.1-tests.py b/scripts/acceptance/field-2.0.1-tests.pynew file mode 100644index 00000000..a7909407--- /dev/null+++ b/scripts/acceptance/field-2.0.1-tests.py@@ -0,0 +1,115 @@+"""Bounded regression and a real-product fullscreen memory containment check."""+import argparse+import hashlib+import json+import os+from pathlib import Path+import re+import shutil+import subprocess+import sys++ROOT = Path(__file__).resolve().parents[2]+BASE = Path('E:/项目/Veyra')+TASK = 'field-2.0.1-20261002'+BUILD = BASE / 'build' / TASK+QT = Path('C:/veyra-deps/qt-veyra/6.8.3/msvc2022_64')+++def main():+ parser = argparse.ArgumentParser()+ parser.add_argument('label')+ parser.add_argument('--app', type=Path, default=BASE / 'tests' / TASK / 'app')+ parser.add_argument('--memory', action='store_true')+ parser.add_argument('--fg', action='store_true')+ args = parser.parse_args()+ if not re.fullmatch('[a-z0-9-]+', args.label):+ raise ValueError('Invalid evidence label')+ subprocess.run([sys.executable, '-B', str(ROOT / 'scripts/acceptance/field-2.0.1-control.py')], check=True)+ out = BASE / 'tests' / TASK / args.label+ tmp = BASE / 'tmp' / TASK / args.label+ out.mkdir(exist_ok=False)+ tmp.mkdir(exist_ok=False)+ env = os.environ.copy()+ env.update(TEMP=str(tmp), TMP=str(tmp), QML_DISABLE_DISK_CACHE='1',+ PATH=str(QT / 'bin') + os.pathsep + env['PATH'])+ results = []+ if not args.memory:+ env.update(QT_QPA_PLATFORM='offscreen', QT_QUICK_BACKEND='software',+ QT_QUICK_CONTROLS_STYLE='Basic', QT_QPA_FONTDIR='C:/Windows/Fonts',+ QT_FORCE_STDERR_LOGGING='1',+ VEYRA_EXPORT_TEST_ARTIFACTS=str(out / 'qml-images'))+ (out / 'qml-images').mkdir()+ shutil.copytree(ROOT / 'tests/qml/quick', args.app / 'qml-tests', dirs_exist_ok=True)+ for name in ('Qt6Test.dll', 'Qt6QuickTest.dll'):+ shutil.copy2(QT / 'bin' / name, args.app / name)+ for name in ('repair_contract', 'xbox', 'qml_data', 'ui_i18n', 'qml_quick'):+ exe = args.app / ('veyra_' + name + '_tests.exe')+ shutil.copy2(BUILD / exe.name, exe)+ parameters = [str(out / 'data')] if name == 'qml_data' else []+ with (out / (name + '.log')).open('xb') as log:+ completed = subprocess.run([str(exe), *parameters], cwd=args.app, env=env,+ stdout=log, stderr=subprocess.STDOUT, timeout=290)+ results.append({'name': name, 'exit': completed.returncode,+ 'exeSha256': hashlib.sha256(exe.read_bytes()).hexdigest()})+ print(json.dumps(results[-1]), flush=True)+ else:+ # Inject retained GPU allocations only while the real UI is fullscreen.+ # This checks containment, never claims to reproduce the field allocation owner.+ snippet = out / 'memory.qml'+ snippet.write_text('''+ Timer { interval: 150; running: true; repeat: true; onTriggered: veyra.logUi("uitest-tick", "") }+ Timer {+ interval: 1000; running: true; repeat: true+ property int ticks: 0+ onTriggered: {+ ++ticks+ if (ticks === 2) dialogs.open("capture")+ if (ticks === 6) {+ const f = veyra.captureFormats.find(x => x.label.indexOf("2560 x 1440 @ 60") === 0 && x.label.indexOf("NV12") > 0)+ if (!f) { veyra.logUi("uitest", "UITEST_FAIL capture format unavailable"); return }+ veyra.captureFormatKey = f.id+ veyra.nrEnabled = true+ veyra.fgEnabled = FG_VALUE+ veyra.startCaptureSession(); dialogs.close()+ }+ if (ticks === 20) root.toggleFullscreen()+ if (ticks === 62) {+ if (root.fullscreen || veyra.fullscreenMemorySafe !== false || !veyra.hasSource || !veyra.nrEnabled || veyra.fgEnabled !== FG_VALUE) {+ veyra.logUi("uitest", "UITEST_FAIL memory fallback did not preserve source/effects"); return+ }+ root.toggleFullscreen()+ if (root.fullscreen) { veyra.logUi("uitest", "UITEST_FAIL unsafe fullscreen re-entry accepted"); return }+ veyra.logUi("uitest", "UITEST_NOTE windowed source/effects preserved; unsafe fullscreen blocked")+ }+ if (ticks === 72) veyra.stopPlayback()+ if (ticks === 76) {+ veyra.logUi("uitest", "UITEST_DONE"); running = false; root.close()+ }+ }+ }+'''.replace('FG_VALUE', 'true' if args.fg else 'false'), encoding='utf8')+ env.update(VEYRA_TEST_VRAM_LEAK_MIB='64', VEYRA_TEST_VRAM_LEAK_FULLSCREEN_ONLY='1')+ completed = subprocess.run([sys.executable, '-B', str(ROOT / 'scripts/ui-check/ui-check.py'),+ str(args.app), str(out / 'run'), str(snippet)], cwd=ROOT, env=env, timeout=110)+ log = (out / 'run/app.log').read_text(encoding='utf8', errors='replace')+ event = re.search(r'(\S+).*sustained fullscreen growth (\d+) MiB', log)+ post = log[event.end():] if event else ''+ samples = [int(x) for x in re.findall(r'vramMiB=(\d+)', post)]+ frames = [int(x) for x in re.findall(r'completedReal=(\d+)', post)]+ ok = (completed.returncode == 0 and event and 'unsafe fullscreen blocked' in log and+ len(samples) >= 10 and max(samples[3:]) - min(samples[3:]) <= 128 and+ len(frames) >= 10 and frames[-1] > frames[0] + 300 and+ 'rebuilding the' not in post and 'UITEST_FAIL' not in log)+ results.append({'name': 'fullscreen_memory_containment', 'fg': args.fg,+ 'exit': 0 if ok else 1, 'injectedAllocations': True,+ 'postFallbackMiB': [min(samples), max(samples)] if samples else [],+ 'postFallbackCompletedReal': [frames[0], frames[-1]] if frames else []})+ print(json.dumps(results[-1]), flush=True)+ (out / 'summary.json').write_text(json.dumps(results, indent=2), encoding='utf8')+ subprocess.run([sys.executable, '-B', str(ROOT / 'scripts/acceptance/field-2.0.1-control.py')], check=True)+ raise SystemExit(any(r['exit'] for r in results))+++if __name__ == '__main__':+ main()diff --git a/scripts/ui-check/field-2.0.1-vram.qml b/scripts/ui-check/field-2.0.1-vram.qmlnew file mode 100644index 00000000..bec3cf3d--- /dev/null+++ b/scripts/ui-check/field-2.0.1-vram.qml@@ -0,0 +1,28 @@+ // Real product capture/NR/FG/fullscreen check. No driver settings are changed.+ Timer { interval: 150; running: true; repeat: true; onTriggered: veyra.logUi("uitest-tick", "") }+ Timer {+ interval: 1000; running: true; repeat: true+ property int ticks: 0+ onTriggered: {+ ++ticks+ if (ticks === 2) {+ veyra.logUi("uitest", "UITEST_NOTE screens=" + Qt.application.screens.map(s => s.name + ":" + s.width + "x" + s.height).join(","))+ dialogs.open("capture")+ }+ if (ticks === 6) {+ const f = veyra.captureFormats.find(x => x.label.indexOf("3840 x 2160 @ 60") === 0 && x.label.indexOf("NV12") > 0)+ || veyra.captureFormats.find(x => x.label.indexOf("2560 x 1440 @ 60") === 0 && x.label.indexOf("NV12") > 0)+ if (!f) { veyra.logUi("uitest", "UITEST_FAIL no 4K/1440p60 NV12 capture format"); running = false; return }+ veyra.captureFormatKey = f.id+ veyra.logUi("uitest", "UITEST_NOTE format=" + f.label)+ veyra.nrEnabled = true+ veyra.fgEnabled = false+ if (!veyra.startCaptureSession()) { veyra.logUi("uitest", "UITEST_FAIL capture start rejected"); running = false; return }+ dialogs.close()+ }+ if (ticks === 40) { veyra.logUi("uitest", "UITEST_NOTE fullscreen NR on FG off"); root.toggleFullscreen() }+ if (ticks === 130) { veyra.logUi("uitest", "UITEST_NOTE fullscreen NR on FG on"); veyra.fgEnabled = true }+ if (ticks === 230) { veyra.logUi("uitest", "UITEST_NOTE fullscreen off"); root.toggleFullscreen() }+ if (ticks === 260) { veyra.logUi("uitest", "UITEST_DONE"); running = false; root.close() }+ }+ }diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cppindex a8184de9..9ab8fdcb 100644--- a/src/engine/EngineController.cpp+++ b/src/engine/EngineController.cpp@@ -650,20 +650,29 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s// at the driver or an overlay hooked on it, the graph step at our own passes.uint64_t vramFloor=0,vramRevision=~0ull,vramRecoverBefore=0,vramRecoverGrowth=0;auto vramSettleUntil=Clock::now(),vramRecoverCheckAt=Clock::now();bool vramWarned=false;int vramRecoverStep=0,vramRecoverDone=0,vramRecoveries=0;+ bool vramFullscreenBlocked=false;unsigned vramGrowthSamples=0;// VEYRA_TEST_VRAM_LEAK_MIB=n: hold on to n MiB more of video memory every second;// VEYRA_TEST_VRAM_LEAK_RELEASE=1 lets the swapchain rebuild free it (as a leak tied// to the swapchain would), otherwise nothing frees it.const uint64_t testLeakMiB=[]{wchar_t v[16]{};return GetEnvironmentVariableW(L"VEYRA_TEST_VRAM_LEAK_MIB",v,16)?uint64_t(_wtoi(v)):0ull;}();const bool testLeakReleases=GetEnvironmentVariableW(L"VEYRA_TEST_VRAM_LEAK_RELEASE",nullptr,0)>0;+ const bool testLeakFullscreenOnly=GetEnvironmentVariableW(L"VEYRA_TEST_VRAM_LEAK_FULLSCREEN_ONLY",nullptr,0)>0;std::vector<Microsoft::WRL::ComPtr<ID3D12Resource>> testLeak;auto watchVram=[&](uint64_t usage,uint64_t budget){- if(testLeakMiB){+ bool fullscreen=false;+ {std::lock_guard lock(mutex_);fullscreen=presentation_.fullscreen;}+ if(testLeakMiB&&(!testLeakFullscreenOnly||fullscreen)){const D3D12_HEAP_PROPERTIES heap{D3D12_HEAP_TYPE_DEFAULT};D3D12_RESOURCE_DESC desc{};desc.Dimension=D3D12_RESOURCE_DIMENSION_BUFFER;desc.Width=testLeakMiB<<20;desc.Height=1;desc.DepthOrArraySize=1;desc.MipLevels=1;desc.SampleDesc.Count=1;desc.Layout=D3D12_TEXTURE_LAYOUT_ROW_MAJOR;Microsoft::WRL::ComPtr<ID3D12Resource> r;if(SUCCEEDED(ctx.device()->CreateCommittedResource(&heap,D3D12_HEAP_FLAG_NONE,&desc,D3D12_RESOURCE_STATE_COMMON,nullptr,IID_PPV_ARGS(&r))))testLeak.push_back(r);}if(!usage)return;+ // Leaving fullscreen stopped further growth in both field logs. Preserve+ // the source/effects and avoid repeated failed graph rebuilds. This only+ // contains the observed trigger; it does not identify the allocation owner+ // or promise that already retained memory is returned.+ if(vramFullscreenBlocked)return;if(vramRecoverDone){if(Clock::now()<vramRecoverCheckAt)return;const int64_t released=(int64_t(vramRecoverBefore)-int64_t(usage))/(1<<20);@@ -679,26 +688,37 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sreturn;}if(vramRecoverStep)return;- if(options.settings.revision!=vramRevision){vramRevision=options.settings.revision;vramFloor=0;vramSettleUntil=Clock::now()+std::chrono::seconds(10);}+ if(options.settings.revision!=vramRevision){vramRevision=options.settings.revision;vramFloor=0;vramGrowthSamples=0;vramSettleUntil=Clock::now()+std::chrono::seconds(10);}if(Clock::now()<vramSettleUntil)return;if(!vramFloor||usage<vramFloor)vramFloor=usage;- const uint64_t growth=usage-vramFloor,limit=std::max<uint64_t>(2048ull<<20,budget/4);+ const uint64_t growth=usage-vramFloor;+ const uint64_t fullscreenLimit=std::max<uint64_t>(512ull<<20,std::min<uint64_t>(2048ull<<20,budget/8));+ if(fullscreen&&growth>fullscreenLimit){+ if(++vramGrowthSamples<3)return;+ vramFullscreenBlocked=true;vramWarned=true;+ const std::wstring injected=gfx::riskyInjections();+ {+ std::lock_guard lock(mutex_);+ snapshot_.vramRunawayMiB=growth>>20;snapshot_.vramInjected=injected;snapshot_.vramFullscreenUnsafe=true;+ }+ veyra::log::warn("vram-watch",std::format("sustained fullscreen growth {} MiB (usage {} / budget {} MiB); requesting windowed playback, preserving source/effects; allocation owner unconfirmed; modules: {}",+ growth>>20,usage>>20,budget>>20,gfx::thirdPartyModules()));+ return;+ }+ vramGrowthSamples=0;+ const uint64_t limit=std::max<uint64_t>(2048ull<<20,budget/4);if(growth<=limit)return;- // NVIDIA App's picture plug-in (nvppex.dll: RTX HDR, Smooth Motion, RTX Dynamic- // Vibrance) and the driver present layer engage for fullscreen windows. With it- // loaded, field logs grew ~700 MiB/min only in fullscreen and neither a swapchain- // nor a graph rebuild gave any of it back (5060 Ti, 2026-10-02): the memory is not- // ours to free, and every rebuild only flashed the picture. Name it instead.+ // Module presence is diagnostic context, not proof of allocation ownership.+ // Evaluate a bounded recovery by the measured memory result, regardless of+ // whether NVIDIA's plug-in (also present in stable local runs) is loaded.const std::wstring injected=gfx::riskyInjections();- const bool driverPlugin=injected.find(L"nvppex")!=std::wstring::npos||injected.find(L"NvPresent64")!=std::wstring::npos;if(!vramWarned){vramWarned=true;veyra::log::warn("vram-watch",std::format("video memory grew {} MiB with no settings change (now {} of {} MiB budget); third-party modules: {}",growth>>20,usage>>20,budget>>20,gfx::thirdPartyModules()));std::lock_guard lock(mutex_);snapshot_.vramRunawayMiB=growth>>20;snapshot_.vramInjected=injected;}else veyra::log::warn("vram-watch",std::format("video memory grew {} MiB again (now {} MiB)",growth>>20,usage>>20));- if(driverPlugin){vramFloor=usage;veyra::log::warn("vram-watch","NVIDIA App picture plug-in / present layer loaded; not rebuilding (it did not release this memory in field logs)");}- else if(vramRecoveries<3){++vramRecoveries;vramRecoverStep=1;vramRecoverGrowth=growth;}+ if(vramRecoveries<3){++vramRecoveries;vramRecoverStep=1;vramRecoverGrowth=growth;}else{vramFloor=usage;} // give up rebuilding; report again only on further growth};auto anchor=Clock::now(),statsStart=anchor;double anchorMs=0;uint64_t frames=0,sourceFrames=0;bool wasPaused=false;double discardBefore=0;diff --git a/src/source/XboxSessionSource.cpp b/src/source/XboxSessionSource.cppindex bcf256c2..c950805d 100644--- a/src/source/XboxSessionSource.cpp+++ b/src/source/XboxSessionSource.cpp@@ -321,7 +321,9 @@ void XboxSessionSource::run(XboxConnectDesc desc) {ApiSignaling signaling(*p.api, p.sessionId);std::string error;if (!p.rtc.start(signaling, &error)) {- fail(L"无法和主机建立连接:" + widen(error) + L"。请确认本机网络没有拦截 UDP,主机与本机最好在同一局域网。");+ // SDP/service failures happen before an ICE/UDP connection is attempted.+ // Keep the actual stage instead of diagnosing every failure as a firewall.+ fail(L"Xbox 连接失败:" + widen(error));return;}if (!p.rtc.waitReady(std::chrono::seconds(10))) { fail(L"主机连上了,但没有完成握手。请重试。"); return; }diff --git a/src/ui/PlayerUiFacade.cpp b/src/ui/PlayerUiFacade.cppindex 0bb866d8..c1473e02 100644--- a/src/ui/PlayerUiFacade.cpp+++ b/src/ui/PlayerUiFacade.cpp@@ -43,6 +43,7 @@ bool sameSnapshot(const veyra::engine::PlayerSnapshot& a, const veyra::engine::Pa.sourceWidth == b.sourceWidth && a.sourceHeight == b.sourceHeight &&a.sourceDisplayAspect == b.sourceDisplayAspect && a.sourceRotationDegrees == b.sourceRotationDegrees &&a.capture == b.capture && a.image == b.image &&+ a.vramRunawayMiB == b.vramRunawayMiB && a.vramFullscreenUnsafe == b.vramFullscreenUnsafe &&a.metrics.resolution.base.width == b.metrics.resolution.base.width &&a.metrics.resolution.base.height == b.metrics.resolution.base.height &&a.metrics.resolution.nr.width == b.metrics.resolution.nr.width &&diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cppindex 94c219b0..85019a2d 100644--- a/src/ui/QmlPlayerBridge.cpp+++ b/src/ui/QmlPlayerBridge.cpp@@ -893,21 +893,19 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesystconst bool wasRunning = impl_->snapshot.running;const bool wasImage = impl_->snapshot.image;const bool wasFailed = impl_->snapshot.failed;+ const bool wasFullscreenUnsafe = impl_->snapshot.vramFullscreenUnsafe;const auto wasTransport = impl_->snapshot.transport;const uint64_t wasSession = impl_->snapshot.sessionId;if(impl_->poll()){emit settingsChanged();emit chainChanged();}- if (impl_->snapshot.vramRunawayMiB && impl_->vramNoticeSession != impl_->snapshot.sessionId) {+ if (impl_->snapshot.vramRunawayMiB && (impl_->vramNoticeSession != impl_->snapshot.sessionId ||+ (!wasFullscreenUnsafe && impl_->snapshot.vramFullscreenUnsafe))) {impl_->vramNoticeSession = impl_->snapshot.sessionId;- const auto& injected = impl_->snapshot.vramInjected;- if (injected.find(L"nvppex") != std::wstring::npos || injected.find(L"NvPresent64") != std::wstring::npos)- emit notice(tr("显存在设置没变的情况下涨了 %1 GB。检测到 NVIDIA App 的画面插件(RTX HDR / 智能平滑运动 / RTX 动态鲜艳度)注入了 Veyra:"- "它只在全屏时介入,这部分显存很可能由它占用,Veyra 重建也释放不了。请在 NVIDIA App → 图形 → 程序设置里为 Veyra 关闭这几项,"- "或退出全屏;已占用的显存要重开 Veyra 才会释放")+ if (impl_->snapshot.vramFullscreenUnsafe)+ emit notice(tr("全屏期间显存持续增长了 %1 GB,已退出全屏保护播放;当前会话使用窗口播放。增强设置保留。"+ "原因尚未确认,可开启设置中的 OBS 游戏采集兼容、重启后测试全屏。").arg(impl_->snapshot.vramRunawayMiB / 1024.0, 0, 'f', 1), true);- else emit notice(tr("显存在设置没变的情况下涨了 %1 GB,已自动重建显示链回收显存(画面会闪一下)。"- "如果反复出现:常见原因是 NVIDIA Smooth Motion、游戏加加、小飞机(RTSS)、显卡叠加层/即时重放"- "或录屏软件在全屏时注入了本程序,请关掉它们后再试,并把日志发给我们(vram-watch)")- .arg(impl_->snapshot.vramRunawayMiB / 1024.0, 0, 'f', 1), true);+ else emit notice(tr("显存在设置未变时增加了 %1 GB,正在尝试回收;回收结果见诊断日志。原因尚未确认。")+ .arg(impl_->snapshot.vramRunawayMiB / 1024.0, 0, 'f', 1), true);}tickSubtitles();tickImageBatch();@@ -5625,6 +5623,7 @@ void QmlPlayerBridge::setContentRate(int value) {}int QmlPlayerBridge::displaySync() const { return int(impl_->presentation.display); }+bool QmlPlayerBridge::fullscreenMemorySafe() const { return !impl_->snapshot.vramFullscreenUnsafe; }void QmlPlayerBridge::setPresentationFullscreen(bool value) {if(impl_->presentation.fullscreen==value)return;impl_->presentation.fullscreen=value;diff --git a/src/xbox/StreamApi.cpp b/src/xbox/StreamApi.cppindex 94a60d22..1b0d1400 100644--- a/src/xbox/StreamApi.cpp+++ b/src/xbox/StreamApi.cpp@@ -6,6 +6,7 @@#include <ws2tcpip.h>#include <chrono>+#include <cstdlib>#include <nlohmann/json.hpp>#include <sstream>#include <thread>@@ -26,6 +27,29 @@ json parse(const HttpsResponse& response, const std::string& what) {}}+std::string text(const json& object, const char* key) {+ const auto it = object.find(key);+ return it != object.end() && it->is_string() ? it->get<std::string>() : std::string();+}++// Greenlight's SDPResponse defines code as number | null and message as+// string | null. State errors also use string codes. Null is common on success;+// it is not evidence that the console refused the offer.+std::string errorCode(const json& details) {+ const auto it = details.find("code");+ if (it == details.end() || it->is_null()) return {};+ if (it->is_string()) return it->get<std::string>();+ if (it->is_number_integer()) return *it == 0 ? std::string() : it->dump();+ return {};+}++std::string serviceError(const json& response) {+ const auto it = response.find("errorDetails");+ if (it == response.end() || !it->is_object()) return {};+ const std::string code = errorCode(*it), message = text(*it, "message");+ return message.empty() ? code : code.empty() ? message : code + " / " + message;+}+} // namespaceStreamApi::StreamApi(std::shared_ptr<HttpsTransport> transport, std::string host, std::string gsToken)@@ -94,8 +118,8 @@ SessionState StreamApi::state(const std::string& sessionId) {s.state = j.value("state", "");if (j.contains("errorDetails") && j["errorDetails"].is_object()) {const json& e = j["errorDetails"];- s.errorCode = e.contains("code") && e["code"].is_string() ? e["code"].get<std::string>() : std::string();- s.errorMessage = e.contains("message") && e["message"].is_string() ? e["message"].get<std::string>() : std::string();+ s.errorCode = errorCode(e);+ s.errorMessage = text(e, "message");}return s;}@@ -104,33 +128,27 @@ void StreamApi::connect(const std::string& sessionId, const std::string& transfecall("POST", "/v5/sessions/home/" + sessionId + "/connect", json{{"userToken", transferToken}}.dump());}-// The service answers 204 until the console has replied; poll a bounded number of times.+// The service returns 204 or a nullable pending wrapper until the console replies.+// Keep the same bounded polling budget for both forms.std::string StreamApi::getExchange(const std::string& path) {for (int attempt = 0; attempt < 40; ++attempt) {const HttpsResponse response = call("GET", path, "");if (response.status != 204 && !response.body.empty()) {const json j = parse(response, path);- // json::value() throws on a null field ("type must be string, but is null"):- // the service sends null exchangeResponse / error fields on a refusal, and the- // exception text hid the reason (field log 2026-10-02). Read only strings.- const auto text = [](const json& o, const char* key) {- return o.contains(key) && o[key].is_string() ? o[key].get<std::string>() : std::string();- };- std::string why;- if (j.contains("errorDetails") && j["errorDetails"].is_object()) {- const std::string code = text(j["errorDetails"], "code"), message = text(j["errorDetails"], "message");- why = message.empty() ? code : code.empty() ? message : code + " / " + message;+ if (!j.is_object()) throw std::runtime_error(path + ": invalid exchange wrapper");+ const std::string why = serviceError(j);+ if (!why.empty()) {+ log::warn("xbox", "exchange " + path.substr(path.rfind('/')) + " failed: " + why);+ throw std::runtime_error(path.substr(path.rfind('/') + 1) + ": the service reported " + why);}- const std::string exchange = text(j, "exchangeResponse");- if (!why.empty() || exchange.empty()) {- log::warn("xbox", "exchange " + path.substr(path.rfind('/')) + " answered without a response: " + j.dump());- if (why.empty()) why = text(j, "status");- throw std::runtime_error(path.substr(path.rfind('/') + 1) + ": the console refused (" +- (why.empty() ? std::string("no reason given") : why) + ")");+ const auto exchange = j.find("exchangeResponse");+ if (exchange != j.end() && !exchange->is_null()) {+ if (!exchange->is_string()) throw std::runtime_error(path + ": invalid exchangeResponse type");+ const std::string value = exchange->get<std::string>();+ if (!value.empty()) return value;}- return exchange;}- std::this_thread::sleep_for(std::chrono::milliseconds(retryDelayMs_));+ if (attempt + 1 < 40) std::this_thread::sleep_for(std::chrono::milliseconds(retryDelayMs_));}throw std::runtime_error(path + ": the console did not answer");}@@ -157,24 +175,14 @@ std::string StreamApi::exchangeSdp(const std::string& sessionId, const std::stri} catch (const json::exception&) {throw std::runtime_error("the console's answer is not JSON");}- // A refusal comes back with "sdp": null plus a status and error details (field log- // 2026-10-01: value("sdp") threw on the null and hid the reason). Log the whole answer- // without the SDP body; it carries no credentials.- const auto text = [&](const char* key) {- return answer.contains(key) && answer[key].is_string() ? answer[key].get<std::string>() : std::string();- };- const std::string sdp = text("sdp");- if (sdp.empty()) {+ if (!answer.is_object()) throw std::runtime_error("the console's SDP answer is not an object");+ const std::string sdp = text(answer, "sdp"), error = serviceError(answer);+ if (sdp.empty() || !error.empty()) {json summary = answer;summary.erase("sdp");- log::warn("xbox", "console SDP answer without SDP: " + summary.dump());- std::string why = text("status");- if (answer.contains("errorDetails") && answer["errorDetails"].is_object()) {- const json& e = answer["errorDetails"];- for (const char* key : {"code", "message"})- if (e.contains(key) && e[key].is_string()) why += std::string(why.empty() ? "" : " / ") + e[key].get<std::string>();- }- throw std::runtime_error("the console refused the offer (" + (why.empty() ? std::string("no reason given") : why) + ")");+ log::warn("xbox", "invalid console SDP answer: " + summary.dump());+ const std::string why = error.empty() ? text(answer, "status") : error;+ throw std::runtime_error("the console returned no usable SDP (" + (why.empty() ? std::string("no reason given") : why) + ")");}return sdp;}@@ -195,12 +203,18 @@ bool StreamApi::teredoIpv4(const std::string& ipv6, std::string* ipv4, int* portstd::vector<IceCandidate> StreamApi::parseIce(const std::string& exchangeResponse) {std::vector<IceCandidate> out;const json list = json::parse(exchangeResponse);+ if (!list.is_array()) throw std::runtime_error("the console's ICE candidates are not an array");for (const auto& c : list) {IceCandidate candidate;- candidate.candidate = c.value("candidate", "");- candidate.sdpMid = c.contains("sdpMid") ? (c["sdpMid"].is_string() ? c["sdpMid"].get<std::string>() : std::to_string(c["sdpMid"].get<int>())) : "0";- candidate.sdpMLineIndex = c.contains("sdpMLineIndex") ? (c["sdpMLineIndex"].is_string() ? std::atoi(c["sdpMLineIndex"].get<std::string>().c_str()) : c["sdpMLineIndex"].get<int>()) : 0;+ candidate.candidate = text(c, "candidate");if (candidate.candidate.empty() || candidate.candidate == "a=end-of-candidates") continue;+ candidate.sdpMid = text(c, "sdpMid");+ if (candidate.sdpMid.empty()) candidate.sdpMid = c.contains("sdpMid") && c["sdpMid"].is_number_integer() ? c["sdpMid"].dump() : "0";+ if (c.contains("sdpMLineIndex")) {+ const json& index = c["sdpMLineIndex"];+ if (index.is_string()) candidate.sdpMLineIndex = std::atoi(index.get<std::string>().c_str());+ else if (index.is_number_integer()) candidate.sdpMLineIndex = index.get<int>();+ }// Greenlight: a Teredo candidate also reaches the console on the IPv4 address and port it hides,// and on port 9002 of that address.std::istringstream fields(candidate.candidate);diff --git a/tests/xbox/XboxTests.cpp b/tests/xbox/XboxTests.cppindex 024c6868..e1d00a47 100644--- a/tests/xbox/XboxTests.cpp+++ b/tests/xbox/XboxTests.cpp@@ -153,6 +153,48 @@ void apiTests() {bool threw = false;try { api.connect("ABC-123", "LPT"); } catch (const ServiceError& e) { threw = e.status == 401; }check(threw, "a refused connect is a ServiceError with the status");++ // The xHome wrapper is nullable even on success (Greenlight's SDPResponse).+ // A pending wrapper is different from a console error; neither may be turned+ // into a json type exception or mistaken for a completed negotiation.+ const std::string answer = json{{"sdp", "v=0\r\n"}, {"sdpType", "answer"}, {"status", "success"}}.dump();+ const auto sdpReply = [&](const std::vector<std::pair<int, json>>& replies, std::string* error = nullptr) {+ auto transport = std::make_shared<FakeTransport>();+ StreamApi session(transport, host, "GS");+ session.setRetryDelayMs(0);+ const std::string path = "/v5/sessions/home/test/sdp";+ transport->add(host, path, 202, "");+ for (const auto& [status, body] : replies) transport->add(host, path, status, body.dump());+ try { return session.exchangeSdp("test", "v=0 offer"); }+ catch (const std::exception& e) { if (error) *error = e.what(); return std::string(); }+ };+ check(sdpReply({{200, {{"exchangeResponse", answer}, {"errorDetails", {{"code", nullptr}, {"message", nullptr}}}}}}) == "v=0\r\n",+ "a successful SDP with null error fields is accepted (field log 11 regression)");+ check(sdpReply({{200, {{"exchangeResponse", answer}, {"errorDetails", nullptr}}}}) == "v=0\r\n",+ "a successful SDP with null errorDetails is accepted");+ check(sdpReply({{200, {{"exchangeResponse", answer}, {"errorDetails", {{"code", 0}, {"message", nullptr}}}}}}) == "v=0\r\n",+ "a zero numeric error code does not reject a successful answer");+ check(sdpReply({{200, {{"exchangeResponse", nullptr}, {"errorDetails", {{"code", nullptr}, {"message", nullptr}}}}},+ {202, {{"exchangeResponse", ""}, {"errorDetails", nullptr}}},+ {200, {{"exchangeResponse", answer}, {"errorDetails", nullptr}}}}) == "v=0\r\n",+ "pending 200/202 wrappers are polled until the SDP is ready");+ std::string error;+ check(sdpReply({{200, {{"exchangeResponse", answer}, {"errorDetails", {{"code", 17}, {"message", nullptr}}}}}}, &error).empty() &&+ error.find("17") != std::string::npos,+ "a nonzero numeric service error is not silently accepted even with SDP present");+ error.clear();+ check(sdpReply({{200, {{"exchangeResponse", nullptr}, {"errorDetails", {{"code", "OfferRejected"}, {"message", "unsupported codec"}}}}}}, &error).empty() &&+ error.find("OfferRejected") != std::string::npos && error.find("unsupported codec") != std::string::npos,+ "a real console refusal preserves its code and message");+ error.clear();+ std::vector<std::pair<int, json>> pending(40, {200, {{"exchangeResponse", nullptr}, {"errorDetails", nullptr}}});+ check(sdpReply(pending, &error).empty() && error.find("did not answer") != std::string::npos && error.find("refused") == std::string::npos,+ "an unfinished exchange times out within the bounded polling budget without claiming refusal");+ try {+ const auto nullableIce = StreamApi::parseIce(R"([{"candidate":null,"sdpMid":null,"sdpMLineIndex":null},{"candidate":"a=candidate:1 1 UDP 90 192.168.1.30 9002 typ host","sdpMid":null,"sdpMLineIndex":null}])");+ check(nullableIce.size() == 1 && nullableIce[0].sdpMid == "0" && nullableIce[0].sdpMLineIndex == 0,+ "null ICE metadata and end markers do not abort the connection after SDP succeeds");+ } catch (const std::exception&) { check(false, "null ICE metadata and end markers do not abort the connection after SDP succeeds"); }}// ---------------------------------------------------------------- sign-in