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 dialog hang with huge format lists and UI recovery after GPU resets

Veyra Goal Agentd2239c635b85
diff --git a/AGENTS.md b/AGENTS.md
index f8ef8611..d2d62131 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1,5 +1,7 @@
# Veyra 项目 Agent 执行规则
+> **2026-10-15 现场修复(Claude)**:用户提交 veyra-qml(56).log(卡顿、未响应后条栏图标消失,重连采集后恢复)与 logs(18).zip(2.0.7 打开采集卡闪退),要求排查修复、汇报后关机。存档 `checkpoint/pre-claude-field-20261015`(main 7571919)与 E 盘 `archives/claude-field-20261015`,分支 `claude/field-20261015`。只改采集格式列表缓存/桥接属性/枚举去重、界面设备重建后图标重绘、采集卡 GPU 失败后自动重连一次、收尾补写 DRED 及三个默认不生效的测试开关(`VEYRA_TEST_CAPTURE_EXTRA_RATES`、`VEYRA_TEST_UI_DEVICE_REMOVE`、`VEYRA_TEST_GPU_FAILURE`)。不改默认 GPU 优先级/NR 版本、运行库、模型、驱动、用户配置;无 merge/push/Release、无子 Agent。长时间变卡与 GPU 卡死根因未定,不宣称已修复。详见 docs/FIELD_FIXES_2026-10-15.md。
+
> **2026-10-13 2.0.7正式发布授权**:用户明确直接采用已验2.0.7-test-r2两个包发布GitHub、六群原图替换、README/Release加知识库、完整说明2.0.6以来变化。按docs/RELEASE_2.0.7_PLAN_2026-10-13.md,只改发布文档/图片和外部文件名,ZIP/EXE/运行组件逐字节保持。允许本地main合入、普通push nrvideo/main与两个标签、主v2.0.7两资产及独立非latest源码归档;保留原赞助/Discord/Ko-fi/width220。69旧树/509脏文件、旧包和旧Release保护,全产物E盘;无子Agent/代发/关机。不伪称包内test标识被去掉,不把混合模型取舍或合成误差包装成普遍画质/提速,也不宣称NV显存/BMD/HDR现场已根治。
> **2026-10-12 用户确认 Claude 内容节奏修复实机通过并授权合并重打 2.0.7**:从 main05bc4b5 隔离合入 claude/cadence-exact-20261012(60a93f3、8d11cad),按 docs/TEST_2.0.7_REFRESH_2026-10-12.md 重新构建、定向回归、本地 main 合并与 NVIDIA/AMD 完整测试包;显示2.0.7-test-r2。保护68旧树/509脏文件及已交付原包,全部研发产物在E盘新任务目录。不改用户正在运行的播放器/配置、UI频率/默认GPU优先级/运行库/模型,无新push/Release/关机或子Agent授权。
diff --git a/apps/veyra-qml/main.cpp b/apps/veyra-qml/main.cpp
index b5f3ff2a..55a59bda 100644
--- a/apps/veyra-qml/main.cpp
+++ b/apps/veyra-qml/main.cpp
@@ -913,6 +913,20 @@ static int runApplication(int argc, char** argv, QString& restartProgram, QStrin
});
frameLog->start(10000);
}
+ // A GPU reset takes the interface's own device too (logs 56): Qt cleans up the scene
+ // graph and builds it again on a new device, but Qt 6.8.3's curve-rendered Shapes come
+ // back empty, so every icon was missing. Tell the icons to rebuild their paths.
+ {
+ const auto watch = [&app, &bridge](QQuickWindow* w, const QString& name) {
+ auto lost = std::make_shared<std::atomic<bool>>(false);
+ QObject::connect(w, &QQuickWindow::sceneGraphInvalidated, &app, [lost] { lost->store(true); }, Qt::DirectConnection);
+ QObject::connect(w, &QQuickWindow::sceneGraphInitialized, &bridge, [lost, &bridge, name] {
+ if (lost->exchange(false)) bridge.noteUiDeviceRecreated(name);
+ }, Qt::QueuedConnection);
+ };
+ watch(window, QStringLiteral("main"));
+ if (auto* bar = window->findChild<QQuickWindow*>(QStringLiteral("fullscreenBar"))) watch(bar, QStringLiteral("controlBar"));
+ }
// Test only: VEYRA_TEST_DPI_FLIP=<ms> sends the window the WM_DPICHANGED a move to a
// 150 % screen would, then back to 100 % three seconds later, so the screen-change
// crash (field report 2026-10-01, two monitors) can be reproduced on one monitor.
@@ -927,6 +941,24 @@ static int runApplication(int argc, char** argv, QString& restartProgram, QStrin
QTimer::singleShot(flip, &app, [send] { send(144); });
QTimer::singleShot(flip + 3000, &app, [send] { send(96); });
}
+ // Test only: VEYRA_TEST_UI_DEVICE_REMOVE=<ms> removes the interface's own D3D12 device
+ // on its render thread, as a GPU reset does (logs 56: "Graphics device lost, cleaning up
+ // scenegraph and releasing RHI"), so the interface's recovery can be checked without one.
+ if (const auto remove = qEnvironmentVariableIntValue("VEYRA_TEST_UI_DEVICE_REMOVE"); remove > 0) {
+ QTimer::singleShot(remove, &app, [window] {
+ auto pending = std::make_shared<QMetaObject::Connection>();
+ *pending = QObject::connect(window, &QQuickWindow::beforeRendering, window, [window, pending] {
+ QObject::disconnect(*pending);
+ auto* device = window->rendererInterface()
+ ? static_cast<ID3D12Device*>(window->rendererInterface()->getResource(window, QSGRendererInterface::DeviceResource)) : nullptr;
+ ID3D12Device5* device5 = nullptr;
+ const bool ok = device && SUCCEEDED(device->QueryInterface(IID_PPV_ARGS(&device5)));
+ veyra::log::warn("ui-device-test", std::format("removing the interface D3D12 device ok={}", ok));
+ if (ok) { device5->RemoveDevice(); device5->Release(); }
+ }, Qt::DirectConnection);
+ window->update();
+ });
+ }
// Before every open, place the native window and force the pending layout to
// be applied so the client size the presenter reads is the real one.
diff --git a/docs/FIELD_FIXES_2026-10-15.md b/docs/FIELD_FIXES_2026-10-15.md
new file mode 100644
index 00000000..33ad22eb
--- /dev/null
+++ b/docs/FIELD_FIXES_2026-10-15.md
@@ -0,0 +1,65 @@
+# 现场修复 2026-10-15(Claude):2.0.7 打开采集卡闪退 + GPU 卡死后条栏图标消失
+
+## 授权与范围
+
+用户(2026-10-15):“1.现在有个奇怪的bug,而且本机无法复现……他卡了之后,软件未响应,等响应了之后,没有关闭软件,重新采集了一下采集卡,就好了,说非常的丝滑,未响应恢复后的软件条变成了图1这个样子 2.logs(18).zip是另一个问题,用户反馈2.0.7会闪退……这两个问题修复好之后汇报一下,给我电脑关机”。
+
+- 存档:标签 `checkpoint/pre-claude-field-20261015`(main 7571919,即已发布 2.0.7 的产品源码);`E:/项目/Veyra/archives/claude-field-20261015/{main-7571919.bundle,start.json}`。分支 `claude/field-20261015`。
+- 产物:`E:/项目/Veyra/{build,tests,logs,tmp,downloads}/claude-field-20261015`。现场日志按不可信数据处理(单独目录,只读解析)。
+- 不 merge/push/Release;不改默认设置(GPU 优先级默认“实时”、NR 默认版本)、运行库、模型、驱动、用户配置;不派子 Agent。
+
+## 问题二:2.0.7 打开采集卡面板后“闪退”(logs(18).zip)
+
+### 证据
+- RTX 3080;采集卡 272 个能力项,`GetFrameRateList` 每项返回 120/121 个帧率,合计 15474 个格式。2.0.7 合入的 PR34 按驱动列出全部帧率(2.0.6 每个能力项只有一个),所以只有 2.0.7、只有这类驱动的用户出现。
+- 两次会话都停在 `capture-ui formats=15474 selected=false`,没有 `[crash]` 行和转储:不是异常退出,而是界面停止响应后被关闭。
+- 本机复现:测试开关 `VEYRA_TEST_CAPTURE_EXTRA_RATES=160` 让 MCS 4K-T911 每项多报 1–160 fps,共 15558 个格式。打开面板后界面心跳停止,`--exit-after` 计时器不再触发,进程 372 MB,105 秒后被强制结束(`logs/claude-field-20261015/repro-160-010844`)。日志同样停在中途,因为卡住的进程不再刷写日志缓冲,用户的日志也是这样截断的。
+- 主线程调用栈(dbghelp 采样,`repro-160-010844/ui-thread-stacks.txt`):`QV4::Sequence::virtualGet → Sequence::virtualMetacall → QmlPlayerBridge::qt_static_metacall → QList<QVariant>::operator=`。Qt 6 里列表属性是“序列引用”,每访问一个元素都会重新读取整个属性;`DialogHost.qml` 的 `veyra.captureFormats.find(...)` 因此每个元素都让 C++ 重建 15k 个 QVariantMap,总量约 2.4 亿次,界面卡死。
+
+### 修复
+- `QmlPlayerBridge`:`captureFormats`、分辨率/帧率/像素格式三个选项列表按“生成它们的输入”缓存(格式列表代号、设备、已选分辨率/帧率、界面语言)。缓存不靠 `captureChanged` 清空,因为 QML 绑定先于普通连接收到通知信号。
+- 新属性 `captureFormatLabel`、`captureFormatCostHint`;`DialogHost.qml` 不再在 QML 里搜索 `captureFormats`。
+- `enumerateFormats` 去重改为哈希集合(原来是 O(n²))。
+- 驱动上报的全部帧率照旧列出,PR34 的行为不变。
+
+### 验证(最终程序)
+- 15558 个格式:软件界面与 GPU 界面心跳最大间隔 0.29–0.30 秒(正常抖动);选 1920×1080 / 60 fps / NV12 分别 73 / 46 / 14 ms,标签与提示正确(`final-160-soft-014019`、`final-160-gpu-014038`)。格式枚举 0.03 秒。
+- T911 原本的 378 个格式行为不变(`fix-0-gpu-011620`)。
+
+## 问题一:用久了卡、GPU 卡死后条栏图标消失(veyra-qml(56).log)
+
+### 证据(2.0.6,RTX 4070 SUPER,VC-X7PRO 2560×1440 60,NR SF-v2 + NVOF,GPU 优先级“实时”,D3D12 界面且 NVIDIA 浮窗注入进程)
+- 共 9 次 GPU 卡死:引擎 2 秒等不到帧完成(`GPU-frame-ready-timeout`),系统事件 nvlddmkm 153;等 5 秒设备仍报告“存活”,于是会话以“视频队列或呈现失败;GPU 未报告设备移除”结束;约 13 秒后 Windows 才移除设备(0x887A0006 DEVICE_HUNG)。所以每次 `gpu-failure` 都是 `alive=true`,DRED(记录哪段 GPU 工作卡住)从来没写出来。
+- 界面线程停 14–17 秒(“未响应”)。D3D12 同一进程同一显卡只有一个设备,界面和视频共用,GPU 卡住时界面一起停。随后 Qt 记录 “Graphics device lost, cleaning up scenegraph and releasing RHI”,在新设备上重建界面。
+- 图 1:重建后,所有用 Qt Shape 曲线渲染器画的图标都是空的(Qt 6.8.3),文字和图片正常。本机用测试开关 `VEYRA_TEST_UI_DEVICE_REMOVE` 移除界面设备后复现:首页卡片、条栏、窗口按钮图标全部消失(`uidev-gpu-012720/shot-2.png`)。
+- 卡死后会话直接结束,需要手动重连。20:14 那次用户在 20:16:32 自己重连,之后 60 fps、无停顿;10 秒后重启了软件(多半因为条栏坏了)。
+- 关于“用久了卡”:刚连接时调度等待 p95≈0、回调到呈现 p95≈10 ms;运行一段时间后等待 p95 升到约 16 ms、回调到呈现约 31 ms,并出现采集丢帧(如 21:03–21:09),约每分钟一次约 50 ms 的引擎停顿;两次等待升高之后都发生了 GPU 卡死(20:16:04、21:25:41)。显存平稳(没有泄漏)。采集卡时间戳相对电脑时钟每分钟漂移 44 ms(卡按 60.00024 标时间,实际约 59.95),不开补帧时按“帧到即出”,不用这个时间戳排期,所以不是原因。20:17–20:54 的 30 fps 是用户自己开的 60→30。**这份日志定不出长时间变卡和 GPU 卡死的根因**,未写成已修复。
+
+### 修复
+1. **图标重建**:`main.cpp` 监听每个窗口的 `sceneGraphInvalidated → sceneGraphInitialized`,界面场景图在新设备上重建后,桥接的 `uiDeviceGeneration` 加一;`VIcon` 随之重新设置路径,Qt 重新生成图标几何。
+2. **GPU 卡死后自动重连一次**:引擎快照新增 `gpuFailed`。采集卡会话因 GPU 失败结束时,提示后面加“将自动重新连接采集卡一次”,不跳回首页;等这次会话收尾完成再过 3 秒,按“继续上次”重连。若十分钟内又一次 GPU 失败,就不再自动重连(与原来一样交给用户)。期间打开了别的片源就取消。PS5/PC/Xbox 串流与屏幕捕获不变。
+3. **收尾时补写 DRED**:GPU 失败当时设备仍“存活”的,收尾时(排空队列之后,最多再等 2 秒)再查一次;设备已被移除就写出 DRED 报告(卡住的命令列表和操作),下次日志能看出卡在 NR、光流还是呈现。
+
+### 验证(最终程序,T911 1920×1080 60 NV12)
+- 图标:移除界面设备后图标全部恢复,日志 `ui-device ... generation=1`(`final-uidev-014056/shot-2.png`);连续两次共享设备丢失(generation 1、2)图标都恢复(`gpu-reconnect-013558/shot-3.png`)。
+- 重连:`VEYRA_TEST_GPU_FAILURE=300:6000`(第 300 帧模拟帧完成超时,6 秒后移除设备):会话 1 失败 → `automatic=true` → 收尾 3 秒后重连 → 会话 2 正常运行;会话 2 再失败 → `automatic=false`(`final-reconnect-014109`)。
+- DRED:收尾时检测到移除,记录 `live-presentation-failed-at-teardown alive=false removedReason=0x887A0005`。测试用的 RemoveDevice 本身不产生面包屑(查询返回 0x887A0004),真实的 TDR 会产生。
+
+### 建议(默认值不改,由用户决定)
+- 这位用户先换 2.0.7 本测试包:2.0.7 遇到 NVIDIA 浮窗会自动改用软件界面(logs(15) 卡死修复),界面不再和视频共用 D3D12 设备。
+- 还卡死的话,可以试 NR 版本换“原版/Lecram”、GPU 优先级改“高”,分别看卡死是否消失;再发日志时会带 DRED 报告。
+
+## 测试开关(只在设置了环境变量时生效)
+- `VEYRA_TEST_CAPTURE_EXTRA_RATES=N`:每个能力项多报 1..N fps。
+- `VEYRA_TEST_UI_DEVICE_REMOVE=<ms>`:在界面渲染线程移除界面 D3D12 设备一次。
+- `VEYRA_TEST_GPU_FAILURE=<帧>:<移除延迟ms>`:直播呈现模拟一次 GPU 帧完成超时,可选延迟移除设备(-1 不移除)。
+
+## 构建与回归
+- 构建:`py -3.11 -X utf8 -I E:/项目/Veyra/tmp/claude-field-20261015/build.py`(复用 `build/test-2.0.7-refresh-20261012` 的对象,只编改动闭包),最终日志 `logs/claude-field-20261015/build-20261015-013917`,`veyra_qml_ui.exe` SHA256 `a79714fbcee0c606c45206a5e4a0d7f329ae9a90b3a0a3f8855521492bbf0bef`,显示版本 2.0.7-test-field。
+- 回归(`logs/claude-field-20261015/unit-final-013928`):capture_format_selection 0 失败、repair_contract 259/0、ui_contract PASS、live_timing PASS、present_sink_lifecycle passed=1 debugErrors=0、settings_transaction passed=1 debugErrors=0、qml_quick 68 通过 0 失败。
+- 界面脚本:`tmp/claude-field-20261015/{repro_formats.py,gpu_reconnect.py,run_app_prefs.py,stack_sample.py}`。测试前确认没有其他 Veyra 进程。
+
+## 未验证
+- 用户那张 272 能力项的卡和 RTX 3080 没有实机,本机用测试开关造出同量级格式。
+- 真实 TDR、4070 SUPER、VC-X7PRO 没有实机;自动重连和 DRED 只用模拟的超时和设备移除验证。
+- 长时间变卡与 GPU 卡死的根因未定。
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index 4abca2f6..22d80c36 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -9345,3 +9345,11 @@ ZIP/EXE原字节晋级,仅外部下载名去test-r2;包内显示原标识在
v2.0.7 ID 410800361,published_at 2026-10-12T16:24:59Z,latest/非草稿/非预发布通过;两个运行资产服务器SHA/size等于原test-r2。v2.0.7-sources ID 410800322,两源资产、非latest,未变依赖源保留v2.0.6。main/tag6ede5a7普通atomic推送成功,产品与67ab696相同,后续只补回执文档。remote.py draft/upload/verify-draft/publish/verify-public均通过;public-check.py final全部公开文档/双QR/Ko-fi/Release/下载200,六群原图SHA吻合,飞书带Cookie匿名GET200。最初无Cookie404/循环证据保留,不把它写成知识库本身失效。
旧v2.0.6Release完整稳定字段不变,68其它树/509脏文件/全部原包保护通过。详细docs/RELEASE_2.0.7_REPORT_2026-10-13.md;外部reports/logs回执固定远端正文/资产digest。只读发布辅助检查曾因utf8-sig别名和依赖回执尚未完成失败,原错误说明保留,改编码/顺序后原检查通过,未重发或改资产。原扩展NR+DLSS热切换失败和NV显存/BMD/HDR/AMD实卡限制保留,没有新性能或全硬件通过声明。群公告632字符仅保存给用户,无代发/关机。
+
+## 2026-10-15 现场修复:2.0.7 打开采集卡闪退、GPU 卡死后条栏图标消失(Claude)
+
+- 授权:用户提交 veyra-qml(56).log、logs(18).zip 和条栏截图,要求排查修复两个问题、汇报后关机。存档 checkpoint/pre-claude-field-20261015(main 7571919)与 E:/项目/Veyra/archives/claude-field-20261015;分支 claude/field-20261015。
+- logs(18):272 个能力项 × 120 帧率 = 15474 个格式(PR34 起列出全部帧率)。本机用 VEYRA_TEST_CAPTURE_EXTRA_RATES=160 在 T911 造出 15558 个格式复现卡死;主线程栈证明 QML 的 captureFormats.find 每个元素都重读整个列表(O(n²))。桥接按输入缓存四个列表、新增 captureFormatLabel/captureFormatCostHint、枚举去重改哈希;15558 个格式时界面心跳最大 0.30 秒,选择 73/46/14 ms。
+- 日志 56:9 次 GPU 卡死(nvlddmkm 153),界面与视频共用 D3D12 设备一起停;Qt 重建界面后曲线渲染的 Shape 图标全空(本机移除界面设备复现)。修复:场景图重建后 VIcon 重设路径;采集卡会话因 GPU 失败结束后自动重连一次(十分钟内再失败交给用户);收尾时设备已移除则补写 DRED。长时间变卡与卡死根因未定,默认值不改。
+- 构建/回归:tmp/claude-field-20261015/build.py,最终 build-20261015-013917,exe a79714fb…;7 组单元/集成测试与 qml_quick 68/0 通过(logs/claude-field-20261015/unit-final-013928);界面脚本证据见 docs/FIELD_FIXES_2026-10-15.md。
+- 不 merge/push/Release,不改默认 GPU 优先级/NR 版本、运行库、模型、驱动、用户配置;无子 Agent。
diff --git a/i18n/catalog.json b/i18n/catalog.json
index 4a7a569f..2e4d8948 100644
--- a/i18n/catalog.json
+++ b/i18n/catalog.json
@@ -15716,6 +15716,20 @@
"zh-TW": "{} {}X 補幀初始化失敗,未替換後端或降低倍率;請查看工作診斷日誌",
"en": "{} {}X frame generation could not initialize. The backend and multiplier were retained; see the task diagnostic log.",
"ja": "{} {}X フレーム生成を初期化できませんでした。バックエンドと倍率は維持されています。タスク診断ログを確認してください。"
+ },
+ {
+ "zh": "将自动重新连接采集卡一次",
+ "src": "src/ui/QmlPlayerBridge.cpp",
+ "zh-TW": "將自動重新連接擷取卡一次",
+ "en": "the capture card will be reconnected once automatically",
+ "ja": "キャプチャーカードを一度だけ自動で再接続します"
+ },
+ {
+ "zh": "GPU 已重置,正在自动重新连接采集卡",
+ "src": "src/ui/QmlPlayerBridge.cpp",
+ "zh-TW": "GPU 已重置,正在自動重新連接擷取卡",
+ "en": "The GPU was reset; reconnecting the capture card automatically",
+ "ja": "GPU がリセットされました。キャプチャーカードを自動で再接続しています"
}
]
}
diff --git a/include/veyra/engine/EngineController.h b/include/veyra/engine/EngineController.h
index c8078f84..12f7f681 100644
--- a/include/veyra/engine/EngineController.h
+++ b/include/veyra/engine/EngineController.h
@@ -132,6 +132,9 @@ struct PlayerSnapshot {
int fsrMaxGeneratedFrames=0;
std::string fsrProviderVersion;
bool running=false,failed=false,image=false,capture=false,remotePlay=false;
+ // The session ended because the GPU stopped completing work (frame-ready timeout or a
+ // removed device / driver reset), not because the source failed.
+ bool gpuFailed=false;
int remotePlayState=0; uint64_t remotePlaySkipped=0;
bool remoteRecovering=false;unsigned remoteReconnectAttempts=0;std::wstring remoteRecoveryMessage;
remoteplay::SessionInbox::Snapshot remoteStream;
diff --git a/include/veyra/source/CaptureFrameIntervals.h b/include/veyra/source/CaptureFrameIntervals.h
index 8e5bb71d..4349e79b 100644
--- a/include/veyra/source/CaptureFrameIntervals.h
+++ b/include/veyra/source/CaptureFrameIntervals.h
@@ -1,6 +1,7 @@
#pragma once
#include <dshow.h>
#include <algorithm>
+#include <cstdlib>
#include <vector>
namespace veyra::source {
@@ -17,6 +18,14 @@ inline std::vector<REFERENCE_TIME> captureFrameIntervals(IAMVideoControl* contro
for(long i=0;i<count;++i)if(rates[i]>0&&std::find(out.begin(),out.end(),rates[i])==out.end())out.push_back(rates[i]);
CoTaskMemFree(rates);
}
+ // Tests only: VEYRA_TEST_CAPTURE_EXTRA_RATES=N makes every capability also list
+ // 1..N fps, as the driver in logs(18) did (272 capabilities x 120 rates, 15474
+ // formats), so a card that lists a few rates can reproduce that dialog.
+ static const int extraRates=[]{wchar_t value[16]{};return GetEnvironmentVariableW(L"VEYRA_TEST_CAPTURE_EXTRA_RATES",value,16)?std::clamp(_wtoi(value),0,1000):0;}();
+ for(int rate=1;rate<=extraRates;++rate){
+ const REFERENCE_TIME interval=(10000000+rate/2)/rate;
+ if(std::find(out.begin(),out.end(),interval)==out.end())out.push_back(interval);
+ }
if(queryResult)*queryResult=hr;
return out;
}
diff --git a/include/veyra/ui/QmlPlayerBridge.h b/include/veyra/ui/QmlPlayerBridge.h
index cf2d0a6d..61a9857f 100644
--- a/include/veyra/ui/QmlPlayerBridge.h
+++ b/include/veyra/ui/QmlPlayerBridge.h
@@ -87,6 +87,9 @@ class QmlPlayerBridge : public QObject {
// --- shell preferences -------------------------------------------------
// Kept by the facade so they survive a restart, and read by the shell.
Q_PROPERTY(bool reducedMotion READ reducedMotion WRITE setReducedMotion NOTIFY settingsChanged)
+ // Counts interface graphics devices recreated after a loss (a GPU reset, logs 56). VIcon
+ // re-feeds its path when it changes: Qt 6.8.3's curve renderer leaves recreated nodes empty.
+ Q_PROPERTY(int uiDeviceGeneration READ uiDeviceGeneration NOTIFY uiDeviceGenerationChanged)
Q_PROPERTY(QString defaultPage READ defaultPage WRITE setDefaultPage NOTIFY settingsChanged)
Q_PROPERTY(QString defaultPageLabel READ defaultPageLabel NOTIFY settingsChanged)
// Used by the shell to open on the saved page. Set from the command line in
@@ -121,6 +124,10 @@ class QmlPlayerBridge : public QObject {
// the choice is remembered in capture-preferences.v1 for "continue".
Q_PROPERTY(QVariantList captureFormats READ captureFormats NOTIFY captureChanged)
Q_PROPERTY(QString captureFormatKey READ captureFormatKey WRITE setCaptureFormatKey NOTIFY captureChanged)
+ // The selected format's label ("" when none) and whether it gets the cost hint, so the
+ // dialog never searches captureFormats itself (logs(18): 15474 formats hung it).
+ Q_PROPERTY(QString captureFormatLabel READ captureFormatLabel NOTIFY captureChanged)
+ Q_PROPERTY(bool captureFormatCostHint READ captureFormatCostHint NOTIFY captureChanged)
// Resolution, frame rate and pixel format are three views of captureFormatKey.
// Changing one retargets that key to a media type the device actually enumerated.
Q_PROPERTY(QVariantList captureResolutionOptions READ captureResolutionOptions NOTIFY captureChanged)
@@ -551,6 +558,9 @@ public:
void setColorTemperature(double v);
bool reducedMotion() const;
+ int uiDeviceGeneration() const;
+ // main.cpp: a window's scene graph came back after its graphics device was lost.
+ void noteUiDeviceRecreated(const QString& window);
void setReducedMotion(bool value);
QString defaultPage() const;
void setDefaultPage(const QString& value);
@@ -574,6 +584,8 @@ public:
void setCaptureFlipVertical(bool value);
QVariantList captureFormats() const;
QString captureFormatKey() const;
+ QString captureFormatLabel() const;
+ bool captureFormatCostHint() const;
void setCaptureFormatKey(const QString& key);
QVariantList captureResolutionOptions() const;
QString captureResolutionId() const;
@@ -1145,6 +1157,7 @@ signals:
void exportChanged();
// Emitted when the capture device or screen-target lists are re-enumerated.
void captureChanged();
+ void uiDeviceGenerationChanged();
// User-facing notices the UI shows as a transient message: a rejected
// chain edit, an export that finished, a failed open.
void notice(const QString& text, bool isError);
diff --git a/qml/Veyra/DialogHost.qml b/qml/Veyra/DialogHost.qml
index 8a6f657e..8f1cbeaf 100644
--- a/qml/Veyra/DialogHost.qml
+++ b/qml/Veyra/DialogHost.qml
@@ -292,7 +292,7 @@ Item {
text: captureDialog.live
? veyra.sourceSummary.replace("x", "×") + " · " + veyra.captureFps.toFixed(2) + " fps"
+ (veyra.sourceFormatText.split(" · ").length > 2 ? " · " + veyra.sourceFormatText.split(" · ")[1] : "")
- : captureDialog.labelOf(veyra.captureFormats, veyra.captureFormatKey, qsTr("选择设备和格式后连接"))
+ : (veyra.captureFormatLabel.length ? veyra.captureFormatLabel : qsTr("选择设备和格式后连接"))
color: Theme.t2
font.family: Theme.fontMono
font.pixelSize: 11
@@ -357,7 +357,8 @@ Item {
}
VRow {
label: qsTr("像素格式")
- hint: { const f = veyra.captureFormats.find(x => x.id === veyra.captureFormatKey); return f && f.costHint ? qsTr("该格式比低延迟格式多一道处理环节,高分辨率/高帧率下建议优先低延迟格式") : qsTr("只列出当前分辨率和帧率下的像素格式") }
+ // Never search veyra.captureFormats here: a card can list 15000+ (logs(18)).
+ hint: veyra.captureFormatCostHint ? qsTr("该格式比低延迟格式多一道处理环节,高分辨率/高帧率下建议优先低延迟格式") : qsTr("只列出当前分辨率和帧率下的像素格式")
VSelect {
objectName: "capture-format"
enabled: !veyra.captureQueryBusy && veyra.captureResolutionId.length > 0 && veyra.captureFrameRateId.length > 0
diff --git a/qml/Veyra/VIcon.qml b/qml/Veyra/VIcon.qml
index a44687d5..0f576617 100644
--- a/qml/Veyra/VIcon.qml
+++ b/qml/Veyra/VIcon.qml
@@ -17,6 +17,9 @@ Item {
readonly property bool known: IconData.paths[name] !== undefined
readonly property bool softwareRendering: (typeof vySoftwareUi !== "undefined" && vySoftwareUi)
|| GraphicsInfo.api === GraphicsInfo.Software
+ // Bumped when the interface's graphics device was lost and recreated (GPU reset): Qt
+ // 6.8.3's curve renderer then leaves the new nodes empty until the path changes.
+ readonly property int deviceGeneration: (typeof veyra !== "undefined" && veyra) ? veyra.uiDeviceGeneration : 0
implicitWidth: size
implicitHeight: size
@@ -58,7 +61,7 @@ Item {
strokeWidth: icon.strokeWidth
capStyle: ShapePath.RoundCap
joinStyle: ShapePath.RoundJoin
- PathSvg { path: icon.known ? IconData.paths[icon.name] : "" }
+ PathSvg { path: icon.known ? IconData.paths[icon.name] + (icon.deviceGeneration % 2 ? " " : "") : "" }
}
}
}
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index e87c4444..7497e9b9 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -365,6 +365,9 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
if(!prewarmEnabled_||!ordinaryFile)prewarmed_.reset();
auto gpu=prewarmed_?std::move(prewarmed_):std::make_unique<PreviewGpuSession>();
auto& ctx=gpu->context;auto& ring=gpu->ring;source::MediaFileSource source;
+ // A GPU hang is reported before Windows resets the GPU (field logs: 13 s later). DRED can
+ // only name the stopped command list after the removal, so teardown checks once more.
+ bool gpuFailureAwaitingRemoval=false;
sink::AudioPipeline audioPipe;sink::AudioRenderer audio;VideoPresenter presenter;
auto& coreCache=gpu->core;auto& recentGraphCache=gpu->recent;auto& graph=gpu->graph;
auto& graphBytes=gpu->graphBytes;auto cacheBudgetPolledAt=Clock::now();
@@ -1208,6 +1211,14 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
// (-1 = forever), to exercise the hang watchdog and bounded shutdown.
wchar_t testHangText[16]{};
int testHangMs=GetEnvironmentVariableW(L"VEYRA_TEST_ENGINE_HANG_MS",testHangText,16)?_wtoi(testHangText):0;
+ // Test hook: VEYRA_TEST_GPU_FAILURE=<frames>:<removeAfterMs> fails live presentation
+ // once, as a GPU frame-ready timeout does, and removes this device that many ms
+ // later as the driver reset does (-1 = never), for the recovery paths.
+ wchar_t testGpuFailureText[32]{};int testGpuFailureFrames=0,testGpuRemoveMs=-1;bool testGpuFailure=false;
+ if(GetEnvironmentVariableW(L"VEYRA_TEST_GPU_FAILURE",testGpuFailureText,32)){
+ testGpuFailureFrames=_wtoi(testGpuFailureText);
+ if(const wchar_t* colon=wcschr(testGpuFailureText,L':'))testGpuRemoveMs=_wtoi(colon+1);
+ }
// Declared LAST before the loop on purpose: it is destroyed first at
// scope exit, so the scheduler (whose queued step/finish lambdas
// capture the locals above by reference) is torn down before any of
@@ -1256,8 +1267,18 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
if(audioStarted)publishAudioStatus();
if(audioStarted&&injectFileEndpointLoss&&!fileEndpointLossInjected&&frames>=20){audioPipe.requestEndpointLossForTest();fileEndpointLossInjected=true;}
advanceLive();
- if(liveScheduler&&liveScheduler->failed()){
- if(recoverXessPresentation())continue;
+ if(testGpuFailureFrames>0&&frames>=uint64_t(testGpuFailureFrames)&&liveScheduler){
+ testGpuFailureFrames=0;testGpuFailure=true;
+ veyra::log::warn("engine-test",std::format("simulating a GPU frame-ready timeout; device removal after {} ms",testGpuRemoveMs));
+ if(testGpuRemoveMs>=0){
+ Microsoft::WRL::ComPtr<ID3D12Device5> device;
+ if(SUCCEEDED(ctx.device()->QueryInterface(IID_PPV_ARGS(&device))))
+ std::thread([device,delay=testGpuRemoveMs]{Sleep(DWORD(delay));device->RemoveDevice();veyra::log::warn("engine-test","device removed");}).detach();
+ }
+ }
+ if((liveScheduler&&liveScheduler->failed())||testGpuFailure){
+ if(!testGpuFailure&&recoverXessPresentation())continue;
+ testGpuFailure=false;
bool alive=ctx.reportDeviceFailure("live-presentation-failed");
// A GPU hang is noticed here about two seconds before Windows resets the
// GPU, and DRED only says which command list stopped once the device is
@@ -1265,6 +1286,8 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
// Wait for that, bounded, and report again.
for(int i=0;alive&&i<50;++i){Sleep(100);uint32_t removed=0;alive=ctx.checkDeviceAlive(removed);}
if(!alive)ctx.reportDeviceFailure("live-presentation-failed-after-reset");
+ gpuFailureAwaitingRemoval=alive;
+ {std::lock_guard lock(mutex_);snapshot_.gpuFailed=true;}
status(alive?L"视频队列或呈现失败;GPU 未报告设备移除,请查看诊断":L"GPU 设备已移除或驱动已重置;请稍后重新连接,可切换 NR 运行库后重试",true);break;
}
const float gain=muted_?0.0f:volume_.load();audio.setGain(gain);
@@ -2531,6 +2554,13 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
veyra::log::info("engine","teardown: closing sources");
captureSource.close();screenSource.close();source.close();av_frame_free(&cachedFrame);av_frame_free(&imageFrame);
veyra::log::info("engine","teardown: sources closed");
+ if(gpuFailureAwaitingRemoval){
+ // Usually the drain above already waited for the reset; allow it a little longer.
+ uint32_t removed=0;bool alive=ctx.checkDeviceAlive(removed);
+ for(int i=0;alive&&i<20;++i){Sleep(100);alive=ctx.checkDeviceAlive(removed);}
+ if(!alive)ctx.reportDeviceFailure("live-presentation-failed-at-teardown");
+ else veyra::log::warn("gpu-failure","device still not removed at teardown; no DRED report available");
+ }
gpu->shutdown();
{std::lock_guard lock(mutex_);snapshot_.running=false;snapshot_.audioEndpointRecovering=false;snapshot_.audioRebuffering=false;}
CoUninitialize();
diff --git a/src/source/CaptureCardSource.cpp b/src/source/CaptureCardSource.cpp
index dad3fa04..9a1f6fab 100644
--- a/src/source/CaptureCardSource.cpp
+++ b/src/source/CaptureCardSource.cpp
@@ -8,6 +8,7 @@
#include "veyra/source/CaptureSignalProbe.h"
#include "veyra/pipeline/CaptureUploadFrame.h"
#include "veyra/source/NativeCaptureSink.h"
+#include <unordered_set>
#include <avrt.h>
#include "veyra/source/CaptureBuffer.h"
#include "veyra/source/CaptureFormatRank.h"
@@ -765,6 +766,7 @@ std::wstring CaptureCardSource::makeCapturePath(unsigned videoIndex,const Captur
}
std::vector<CaptureFormat> enumerateFormats(IAMStreamConfig* config,bool preferDriverCurrent=false,IBaseFilter* device=nullptr,IPin* capturePin=nullptr){
std::vector<CaptureFormat> out;if(!config)return out;int count=0,size=0;
+ std::unordered_set<std::wstring> keys; // a driver may list 100+ rates per capability (logs(18): 32759 types)
ComPtr<IPin> pin=capturePin;if(!pin)config->QueryInterface(IID_PPV_ARGS(&pin));
ComPtr<IAMVideoControl> control;if(device)device->QueryInterface(IID_PPV_ARGS(&control));
if(!control&&pin)pin->QueryInterface(IID_PPV_ARGS(&control));
@@ -802,7 +804,7 @@ std::vector<CaptureFormat> enumerateFormats(IAMStreamConfig* config,bool preferD
scan=interlaced?std::format(L"隔行({:.2f} 场/秒)",fps*((flags&AMINTERLACE_1FieldPerSample)?1:2)):L"逐行";}
const std::wstring scanMark=scan.empty()?std::wstring{}:L" · "+scan;
const bool supported=width<=3840&&height<=2160&&(!knownRaw||valid);
- if(std::none_of(out.begin(),out.end(),[&](const CaptureFormat& f){return f.key==key;}))
+ if(keys.insert(key).second)
out.push_back({i,width,height,fps,std::format(L"{} x {} @ {:.3f} fps{} · {} · {} · {}{}{} [format {}]",width,height,fps,scanMark,pixel,support,captureFormatTierLabel(tier),current?L" · 驱动默认":L"",supported?L"":L" · 当前播放器不支持",i),key,rank,int(tier),current,pixel,scan,interlaced,interval,supported});
}
}
diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cpp
index e6bd74a4..cb6863e1 100644
--- a/src/ui/QmlPlayerBridge.cpp
+++ b/src/ui/QmlPlayerBridge.cpp
@@ -344,6 +344,28 @@ struct QmlPlayerBridge::Impl {
int captureQueryKind = 0; // 0 device list, 1 formats, 2 formats then connect (continue)
std::vector<source::CaptureDevice> captureVideo, captureAudio;
std::vector<source::CaptureFormat> captureFormatList;
+ // The capture dialog's lists are built once per input. QML re-reads a list property on
+ // every element access (Qt 6 sequence references), so a getter that rebuilt the list
+ // made `.find()` and VSelect quadratic: 15474 formats hung the interface (logs(18)).
+ // Each cache is checked against what it was built from, not reset by captureChanged:
+ // QML bindings receive a notify signal before any ordinary connection does.
+ uint64_t captureFormatGeneration = 0; // bumped whenever captureFormatList is replaced
+ int uiDeviceGeneration = 0; // interface scene graphs recreated after a lost device
+ // One automatic capture-card reconnect after the GPU stopped completing work. Field
+ // logs 56: after the hang and driver reset the session just ended; reconnecting by hand
+ // ran smoothly again. A second GPU failure within ten minutes is left to the user.
+ uint64_t gpuReconnectSession = 0;
+ std::chrono::steady_clock::time_point gpuReconnectDue{}, gpuReconnectLast{};
+ struct CaptureListCache { bool valid = false; uint64_t generation = 0; QString language; std::wstring a, b; QVariantList list; };
+ CaptureListCache captureFormatsCache, captureResolutionCache, captureRateCache, capturePixelCache;
+ template <class Build> const QVariantList& captureList(CaptureListCache& cache, const std::wstring& a, const std::wstring& b, Build&& build) {
+ const QString language = i18n::current();
+ if (!cache.valid || cache.generation != captureFormatGeneration || cache.language != language || cache.a != a || cache.b != b) {
+ cache.list = build();
+ cache.valid = true; cache.generation = captureFormatGeneration; cache.language = language; cache.a = a; cache.b = b;
+ }
+ return cache.list;
+ }
std::wstring captureFormatKey;
std::wstring captureResolutionChoice, captureRateChoice;
int captureAudioChoice = source::kCaptureAudioDisabled;
@@ -1367,13 +1389,36 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesyst
QFile marker(lastFailurePath());
if (marker.open(QIODevice::WriteOnly)) marker.write((QStringLiteral("device\n") + injected + QStringLiteral("\n")).toUtf8());
}
+ const auto now = std::chrono::steady_clock::now();
+ const bool reconnect = s.gpuFailed && !s.remotePlay && impl_->liveKind == QLatin1String("capture") &&
+ (impl_->gpuReconnectLast == std::chrono::steady_clock::time_point{} || now - impl_->gpuReconnectLast > std::chrono::minutes(10));
+ if (s.gpuFailed) veyra::log::warn("gpu-reconnect", std::format("session={} kind={} automatic={}", s.sessionId, impl_->liveKind.toStdString(), reconnect));
+ if (reconnect) { impl_->gpuReconnectSession = s.sessionId; impl_->gpuReconnectDue = {}; text += QStringLiteral(";") + tr("将自动重新连接采集卡一次"); }
emit notice(text, true);
- if (impl_->currentPage == QLatin1String("min")) emit navigate(QStringLiteral("home"));
+ if (!reconnect && impl_->currentPage == QLatin1String("min")) emit navigate(QStringLiteral("home"));
}
// Engine watchdog (field logs(15)): a frozen picture says why, once.
if (had && !wasEngineHung && s.status == engine::kEngineHangStatus) emit notice(uiText(s.status), true);
emit snapshotChanged();
}
+ // The reconnect waits for the failed session's teardown (the GPU reset can hold it for
+ // seconds) and is dropped if anything else was opened meanwhile.
+ if (impl_->gpuReconnectSession) {
+ const auto& s = impl_->snapshot;
+ const auto now = std::chrono::steady_clock::now();
+ if (s.sessionId != impl_->gpuReconnectSession || impl_->openingSource) {
+ veyra::log::info("gpu-reconnect", "cancelled: another source was opened");
+ impl_->gpuReconnectSession = 0;
+ } else if (!s.running) {
+ if (impl_->gpuReconnectDue == std::chrono::steady_clock::time_point{}) impl_->gpuReconnectDue = now + std::chrono::seconds(3);
+ else if (now >= impl_->gpuReconnectDue) {
+ impl_->gpuReconnectSession = 0; impl_->gpuReconnectLast = now;
+ veyra::log::warn("gpu-reconnect", "reconnecting the capture card after the GPU failure");
+ emit notice(tr("GPU 已重置,正在自动重新连接采集卡"), false);
+ resumeCaptureSession();
+ }
+ }
+ }
// An export in flight needs its own poll; it is a separate job and its
// snapshot is not part of the player snapshot.
if (impl_->exportQueue.queue().needsTick()) pollExport();
@@ -1946,6 +1991,13 @@ void QmlPlayerBridge::resetCurrentPage() {
// --- shell preferences -------------------------------------------------------
bool QmlPlayerBridge::reducedMotion() const { return impl_->facade.reducedMotion(); }
+int QmlPlayerBridge::uiDeviceGeneration() const { return impl_->uiDeviceGeneration; }
+void QmlPlayerBridge::noteUiDeviceRecreated(const QString& window) {
+ ++impl_->uiDeviceGeneration;
+ veyra::log::warn("ui-device", std::format("{} scene graph recreated after a lost graphics device; icons rebuilt generation={}",
+ window.toStdString(), impl_->uiDeviceGeneration));
+ emit uiDeviceGenerationChanged();
+}
void QmlPlayerBridge::setReducedMotion(bool value) {
if (impl_->facade.reducedMotion() == value) return;
impl_->facade.setReducedMotion(value);
@@ -2076,7 +2128,7 @@ void QmlPlayerBridge::setCaptureDeviceId(const QString& value) {
if (impl_->captureDriverSettingsOpen) return;
if (impl_->captureDevice == wideOf(value)) return;
impl_->captureDevice = wideOf(value);
- impl_->captureFormatList.clear();
+ impl_->captureFormatList.clear();++impl_->captureFormatGeneration;
impl_->captureResolutionChoice.clear();impl_->captureRateChoice.clear();
impl_->captureFormatKey=impl_->captureDevice==impl_->capturePrefs.videoPath?impl_->capturePrefs.formatKey:std::wstring{};
impl_->captureDriverFormatKey.clear();
@@ -2093,19 +2145,37 @@ QString QmlPlayerBridge::captureDeviceLabel() const {
for (const auto& d : impl_->captureVideo) if (d.path == impl_->captureDevice) return captureDeviceUiLabel(d);
return impl_->captureDevice.empty() ? tr("未选择设备") : tr("设备未连接");
}
+static QString captureFormatUiLabel(const source::CaptureFormat& f, const std::wstring& device) {
+ auto label=uiText(f.label);
+ if(source::decklink::isPath(device))label=label.replace(QStringLiteral("逐行"),QmlPlayerBridge::tr("逐行")).replace(QStringLiteral("隔行"),QmlPlayerBridge::tr("隔行"));
+ return label;
+}
QVariantList QmlPlayerBridge::captureFormats() const {
- QVariantList out;
- for (const auto& f : impl_->captureFormatList) {
- auto label=uiText(f.label);
- if(source::decklink::isPath(impl_->captureDevice))label=label.replace(QStringLiteral("逐行"),tr("逐行")).replace(QStringLiteral("隔行"),tr("隔行"));
- out << QVariantMap{{"id", utf8Of(f.key)}, {"label", label}, {"tier", f.tier},
- {"costHint", source::captureFormatNeedsCostHint(static_cast<source::CaptureFormatTier>(f.tier))}, {"driverCurrent", f.driverCurrent},
- {"width", int(f.width)}, {"height", int(f.height)}, {"fps", f.fps}, {"pixel", uiText(f.pixel)},
- {"scan", uiText(f.scan)}, {"interlaced", f.interlaced}};
- }
- return out;
+ return impl_->captureList(impl_->captureFormatsCache, impl_->captureDevice, {}, [this] {
+ QVariantList out;
+ out.reserve(qsizetype(impl_->captureFormatList.size()));
+ for (const auto& f : impl_->captureFormatList) {
+ out << QVariantMap{{"id", utf8Of(f.key)}, {"label", captureFormatUiLabel(f, impl_->captureDevice)}, {"tier", f.tier},
+ {"costHint", source::captureFormatNeedsCostHint(static_cast<source::CaptureFormatTier>(f.tier))}, {"driverCurrent", f.driverCurrent},
+ {"width", int(f.width)}, {"height", int(f.height)}, {"fps", f.fps}, {"pixel", uiText(f.pixel)},
+ {"scan", uiText(f.scan)}, {"interlaced", f.interlaced}};
+ }
+ return out;
+ });
}
QString QmlPlayerBridge::captureFormatKey() const { return utf8Of(impl_->captureFormatKey); }
+QString QmlPlayerBridge::captureFormatLabel() const {
+ if (impl_->captureFormatKey.empty()) return {};
+ for (const auto& f : impl_->captureFormatList)
+ if (f.key == impl_->captureFormatKey) return captureFormatUiLabel(f, impl_->captureDevice);
+ return {};
+}
+bool QmlPlayerBridge::captureFormatCostHint() const {
+ if (impl_->captureFormatKey.empty()) return false;
+ for (const auto& f : impl_->captureFormatList)
+ if (f.key == impl_->captureFormatKey) return source::captureFormatNeedsCostHint(static_cast<source::CaptureFormatTier>(f.tier));
+ return false;
+}
void QmlPlayerBridge::setCaptureFormatKey(const QString& key) {
const auto* format=source::selectCaptureFormat(impl_->captureFormatList,-1,wideOf(key));
if(!format){
@@ -2135,7 +2205,7 @@ const source::CaptureFormat* selectedCaptureFormat(const std::vector<source::Cap
}
}
QVariantList QmlPlayerBridge::captureResolutionOptions() const {
- return captureChoiceList(source::captureResolutionOptions(impl_->captureFormatList));
+ return impl_->captureList(impl_->captureResolutionCache, {}, {}, [this] { return captureChoiceList(source::captureResolutionOptions(impl_->captureFormatList)); });
}
QString QmlPlayerBridge::captureResolutionId() const {
return utf8Of(impl_->captureResolutionChoice);
@@ -2152,7 +2222,9 @@ void QmlPlayerBridge::setCaptureResolutionId(const QString& id) {
emit captureChanged();
}
QVariantList QmlPlayerBridge::captureFrameRateOptions() const {
- return captureChoiceList(source::captureFrameRateOptions(impl_->captureFormatList, source::captureResolutionSample(impl_->captureFormatList, impl_->captureResolutionChoice)));
+ return impl_->captureList(impl_->captureRateCache, impl_->captureResolutionChoice, {}, [this] {
+ return captureChoiceList(source::captureFrameRateOptions(impl_->captureFormatList, source::captureResolutionSample(impl_->captureFormatList, impl_->captureResolutionChoice)));
+ });
}
QString QmlPlayerBridge::captureFrameRateId() const {
return utf8Of(impl_->captureRateChoice);
@@ -2169,7 +2241,9 @@ void QmlPlayerBridge::setCaptureFrameRateId(const QString& id) {
emit captureChanged();
}
QVariantList QmlPlayerBridge::capturePixelOptions() const {
- return captureChoiceList(source::capturePixelOptions(impl_->captureFormatList, source::captureRateSample(impl_->captureFormatList,impl_->captureResolutionChoice,impl_->captureRateChoice)));
+ return impl_->captureList(impl_->capturePixelCache, impl_->captureResolutionChoice, impl_->captureRateChoice, [this] {
+ return captureChoiceList(source::capturePixelOptions(impl_->captureFormatList, source::captureRateSample(impl_->captureFormatList,impl_->captureResolutionChoice,impl_->captureRateChoice)));
+ });
}
QString QmlPlayerBridge::capturePixelId() const {
const auto* format = source::selectCapturePixelFormat(impl_->captureFormatList,impl_->captureResolutionChoice,impl_->captureRateChoice,impl_->captureFormatKey);
@@ -2340,6 +2414,7 @@ void QmlPlayerBridge::tickCapture() {
}
if (q.device != i.captureDevice) { emit captureChanged(); return; } // stale answer
i.captureFormatList = std::move(q.formats);
+ ++i.captureFormatGeneration;
const bool remembered = i.captureDevice == i.capturePrefs.videoPath;
const std::wstring driverSelection = i.captureDriverFormatKey.empty() ? i.captureFormatKey : i.captureDriverFormatKey;
if (q.kind == 3) i.captureDriverFormatKey.clear();