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(ui): beta 5 field feedback - pill drag, fullscreen to pro, stable stage bars, load budget, live switch, empty-page source menu, portrait films

Veyra Goal Agentf280f0955ff0
diff --git a/apps/veyra-qml/main.cpp b/apps/veyra-qml/main.cpp
index bd3396f2..8db635ca 100644
--- a/apps/veyra-qml/main.cpp
+++ b/apps/veyra-qml/main.cpp
@@ -54,6 +54,18 @@ HWND g_video = nullptr;
enum class VideoProbeMode { Normal, Hidden, NoRegion, CoversOnly };
VideoProbeMode g_videoProbe = VideoProbeMode::Normal;
bool g_videoHiddenByProbe = false;
+// Set while a new source is opening: the window keeps the previous session's last
+// frame until the new one presents, so its region is emptied instead. A slow PS5
+// connect after a capture card left the card's last frame up for 20 s and the
+// window looked frozen (field report 2026-10-01).
+bool g_videoBlanked = false;
+
+void blankVideo(const char* why) {
+ if (!g_video || g_videoBlanked) return;
+ g_videoBlanked = true;
+ const int result = SetWindowRgn(g_video, CreateRectRgn(0, 0, 0, 0), TRUE);
+ veyra::log::info("qml-window", std::format("blank video until the new source presents ({}) result={}", why, result));
+}
const char* videoProbeName() {
switch (g_videoProbe) {
@@ -221,6 +233,8 @@ void syncVideoCovers(QQuickWindow* window, QQuickItem* host, qreal inset) {
const int w = std::max(1, int(std::floor(host->width() * dpr)));
const int h = std::max(1, int(std::floor(host->height() * dpr)));
static QList<QRect> last;
+ // blankVideo() set the region behind this cache's back.
+ if (g_videoBlanked) { last.clear(); g_videoBlanked = false; }
QList<QRect> holes; // x, y, w, h; the radius rides along as a fifth rect
for (const Cover& c : covers) {
const QRectF local = c.rect.translated(-origin);
@@ -644,7 +658,9 @@ int main(int argc, char** argv) {
// GetParent() is null for an unattached WS_POPUP, so reparenting here on
// every animation frame can starve input and timers before any source opens.
if (!bridge.hasSource()) {
- if (bridge.openingSource()) return;
+ // The window stays up for the presenter, but empty: the QML stage and its
+ // "正在连接" pill show instead of the last source's frozen frame.
+ if (bridge.openingSource()) { blankVideo("opening"); return; }
if (IsWindowVisible(g_video)) {
veyra::log::info("qml-window", "follow: hide video because source snapshot is inactive");
ShowWindow(g_video, SW_HIDE);
diff --git a/docs/TEST_PACKAGE_2.0.0beta6.md b/docs/TEST_PACKAGE_2.0.0beta6.md
new file mode 100644
index 00000000..457f44d7
--- /dev/null
+++ b/docs/TEST_PACKAGE_2.0.0beta6.md
@@ -0,0 +1,134 @@
+# Veyra 2.0.0 beta 6(PC 串流 + Xbox 串流 + 美乐威低延迟)测试说明
+
+## beta 6 修改(根据 beta 5 试用反馈)
+
+- **极简模式播放条**:按住播放条空白处可以拖动窗口。
+- **全屏时点顶栏「专业模式」**:现在会退出全屏并进入专业页(原来没反应)。
+- **专业模式 GPU 阶段耗时条来回跳(0 / 5.8 / 0 / 5.8)**:已修复,条现在稳定显示。
+- **负载预算**:改为"增强链耗时占一帧时间的比例"(例:30 帧视频开 NR 3.8 ms → 11%)。原来显示的是输出帧率是否达标,不掉帧就一直是 100%。
+- **先开采集卡再连 PS5 像卡死**:连接期间不再留着采集卡最后一帧,而是显示黑底和"正在连接 PS5"。日志显示那次是 PS5 主机 20 秒没回应;如果经常连不上,请发日志。
+- **极简模式什么都没打开**:点画面弹出片源菜单。
+- **竖屏视频 / 竖屏窗口捕获,窗口超出屏幕**:窗口高度不再超过屏幕,放不下时窗口变窄;换回横屏片源或离开极简模式会恢复宽度。
+
+详细记录见包内 `docs/UI_FIELD_FIXES_2026-10-01.md`。
+
+---
+
+## beta 5 新增:美乐威 Pro Capture 低延迟模式
+
+- 采集卡对话框「设备」里新增 **美乐威低延迟模式** 开关。只有美乐威 **Pro Capture(PCIe 内置卡)** 能用;USB Capture 系列和其他品牌的卡开关是灰的。
+- 原理:采集卡收到 64 行就开始往电脑传,整帧更早到达。美乐威官方数据:1080p60 约省 5 ms,4K60 约省 15 ms。
+- 用法:选美乐威设备 → 格式选 NV12(YUY2、P010、RGB32 也行)→ 打开开关 → 点「连接并开始」。开关下面那行会显示"低延迟采集中 · 一帧从开始进卡到完整进内存 x ms"。
+- 美乐威的运行库已经放在包里(`runtime\magewell\LibMWCapture.dll`),不用另装 SDK;美乐威驱动照常要装。
+- 如果低延迟启动失败,会自动回到普通采集,画面不会断,那行会写原因。
+- **作者手上没有美乐威卡,这个功能完全没在真卡上跑过。** 请有 Pro Capture 的群友测:能不能出画面、颜色对不对、开关前后延迟手感、音画是否同步、长时间是否稳定;
+ 日志 `logs\veyra-qml.log` 搜 `magewell` 发给我。
+
+beta 4 的修改见下。
+
+---
+
+
+## beta 4 相对 beta 3 的修改(根据双机测试反馈)
+
+- **PC 串流一顿一顿、帧率上不去**:根因是选 AV1 时实际一直在用单线程软件解码(每帧 25–36 ms,跟不上 60 帧,解码队列反复溢出)。
+ 现在 AV1 / H.264 走 D3D12 硬件解码,HEVC 走 D3D11 硬件解码(原来 HEVC 4K 硬解会失败)。本机 150 Mbps 测试流 1080p/4K 都稳定 60 帧。
+- **码率**:默认 150 Mbps,设置里改成滑块,5–500 Mbps 任意调。有线千兆可以拉到 300–500;无线卡顿就调低。
+ 主机画面简单时实际码率会远低于上限,这是编码器正常行为。统计浮层(Ctrl+Alt+Shift+S)现在显示**实际码率**和收/解帧率。
+- **第二次要重新配对、配完连不上**:软件把局域网发现时主机的"未配对"(Sunshine 对不带证书的查询一律这么回答)当真了。已修复。
+ **已经遇到这个问题的电脑**:先在主机 Sunshine 网页的已配对列表里删掉旧的 Veyra,再在本机删除主机、重新配对一次,以后就不会再丢。
+- **退出时偶尔崩溃**:转储指向 NVIDIA Reflex 关闭时卸载了 nvapi,已改为不再卸载。如果还崩,请继续发 `veyra-crash-*.dmp`。
+- **开光流后 1440p 只有 52 帧**:查过了,不是新 bug。RTX 5060 Ti 上 NR 内部 1440p 一项就要约 15 ms,光流再加 2.5 ms,超过 60 帧的 16.7 ms;
+ 1.4.4 开 NR 时也总是跑光流。建议 NR 内部分辨率用 1080p(NR 9 ms + 光流 2 ms,稳 60),或者光流后端换成 AMD(约 0.5 ms)。
+- **玩一段时间掉到 10 帧**:还没定位。日志现在每秒记录显存占用;再出现时请记下时间、看一下显卡温度和频率,并发日志。
+- 聊天截图里有一条关于**鼠标**的问题,图太小看不清,请再描述一次。
+
+详细排查记录见包内 `docs/STREAM_FIELD_FIXES_2026-10-01.md`。
+
+---
+
+
+本包(与 beta 3 相同)在 2.0.0 beta 的基础上新增 **PC 串流** 和 **Xbox 串流**(见文末)。PC 串流:把另一台电脑(装了 Sunshine 的主机)的画面串流到本机播放,
+再交给软件自己的降噪、超分、补帧和调色。**这是第一次接入,只在没有真实主机的情况下做过离线测试,
+请有两台电脑的测试者重点验证。**其余功能与 2.0.0 beta 相同,见同目录 `RELEASE_NOTES.md`。
+
+新界面程序是 `veyra_qml_ui.exe`,整个文件夹可拷到别的电脑运行,设置和日志都在这个文件夹里。
+PC 串流的主机列表、设置和配对身份存在 `%LOCALAPPDATA%\Veyra\moonlight\`(身份文件用 Windows DPAPI 加密)。
+
+## 准备(两台电脑)
+
+1. **被串流的电脑(主机)**:安装 [Sunshine](https://app.lizardbyte.dev/Sunshine)(本软件不自带,也不代为下载)。
+ 显卡需要能硬件编码(NVIDIA / AMD / Intel 均可)。在 Sunshine 网页(`https://主机IP:47990`)里确认有「Desktop」或游戏条目。
+2. **播放的电脑(本机)**:两台电脑在同一个局域网,最好有线。主机防火墙放行 Sunshine(安装时默认处理)。
+3. 打开本软件 → 首页 **「PC 串流」** 卡(或专业/节点页的片源菜单 → PC 串流…)。
+
+## 测试步骤
+
+1. 主机应自动出现在列表里(没有就在「手动添加」填它的 IP)。状态为「未配对」。
+2. 点「配对」:软件显示 4 位 PIN;到主机的 Sunshine 网页 → **PIN** 页,输入这个 PIN 并提交。成功后出现游戏列表。
+3. 选「Desktop」或一个游戏,点「开始串流」。先用默认设置(1080p · 60 fps · 150 Mbps · 自动编码)。
+4. 连上后:画面是否出现、声音是否正常、键盘鼠标是否在主机上生效(连上后键鼠会自动交给主机)、手柄是否可用、手柄震动是否回传。
+5. 键盘鼠标被主机占用时:**Ctrl+Alt+Shift+Z 释放**,点击画面重新捕获,**Ctrl+Alt+Shift+Q 断开**,**Ctrl+Alt+Shift+S** 显示/隐藏统计浮层。
+6. 在专业页打开 NR / 超分 / 补帧,看串流画面能否正常增强(补帧默认是关的,和其它片源一样由你打开)。
+7. 再试:4K · 60 fps、HEVC、AV1、HDR(主机显示器需开 HDR,编码选 HEVC 或 AV1)、5.1 声道、断开后再「继续」同一个游戏。
+8. 局域网内故意拔网线几秒再接上,看是否报错、是否能重连(**重连还没有做,预期是报「连接中断」,请记录现象**)。
+
+## 请重点记录
+
+- 能否连上、从点「开始串流」到出画面要几秒;
+- 延迟感受(画面里的鼠标移动、按键反应);统计浮层里的「主机 / 往返 / 接收 / 排队 / 解码」各几毫秒;
+- 4K60 是否稳定,FEC「未恢复」包数和丢帧数是否持续增长;
+- HDR 颜色是否正确(和主机屏幕对比);
+- 任何崩溃、卡死、花屏、声音断续。
+
+## 反馈时请附上
+
+- 主机:显卡型号、Sunshine 版本、编码器(Sunshine 网页里看);本机:显卡、驱动、Windows 版本;
+- `logs\veyra-qml.log`(出问题后先退出软件再拷,搜 `moonlight`);
+- 统计浮层截图或录屏。
+
+## 已知情况与限制
+
+- **未在真实 Sunshine 上验证过任何串流**:连接、画面、声音、输入、HDR、4K60 都是未知数,这正是本次要测的。
+ 离线只验证了协议解析、配对、界面流程和输入转换。
+- 设备名以「Veyra」向主机报到;若某个主机拒绝配对或在它的已配对列表里显示异常,请告诉我主机软件和版本。
+- 没有做:断线自动重连、陀螺仪与触摸板、多手柄、扳机震动、游戏封面图、Windows 键/Alt+Tab 的捕获(这些仍归系统)。
+- 解码用硬件(AV1/H.264 用 D3D12VA,HEVC 用 D3D11VA);显卡不支持该编码时自动退回软件解码,但软件解码在高码率下跟不上 60 帧,只输出 8 位,HDR 需要硬解。
+- AV1 只在你明确选择时才使用;「自动」只在 HEVC 与 H.264 之间选。
+- 「让主机切换到串流分辨率」默认关:主机保持自己的分辨率,画面由主机缩放。
+- 补帧优化内核和社区 NR 运行库仍是实验组件,见 2.0.0 beta 说明;仅供内部测试,请勿外传。
+
+
+---
+
+# Xbox 串流(非官方、实验)
+
+在首页点 **「Xbox 串流」**(或片源菜单 → Xbox 串流…)。串流的是**你自己的** Xbox 主机,画面同样交给软件的降噪/超分/补帧/调色。
+
+**非官方**:与 Greenlight 等开源客户端相同的方式连接微软的串流服务,不隶属于微软;微软随时可能改动导致失效。账号风险由使用者自行承担(你已确认接受)。
+
+## 准备
+
+1. 主机:用你的账号登录;**设置 → 设备和连接 → 远程功能** 里打开"启用远程功能";电源模式选"睡眠"(即时启动)才能被远程唤醒。
+2. 本机和主机最好在同一个局域网(有线更好)。开着代理/加速器/TUN 的电脑也可以,软件已经处理了这类网卡带来的一个连接问题;如果仍连不上,先试着关掉代理再连。
+
+## 步骤
+
+1. 点「登录」:对话框显示一个登录码。用手机或浏览器打开 **microsoft.com/link**,输入登录码,用你的 Xbox(微软)账号登录。软件看不到你的密码;登录信息加密保存在本机,"退出登录"会删除它。
+2. 登录后自动列出账号下的主机(型号、电源状态)。选一台,点「开始串流」。主机在睡眠时会被唤醒,可能要等十几秒。
+3. 连上后:画面、声音、手柄(默认把电脑手柄当作主机手柄)、震动。Ctrl+Alt+Shift+S 显示统计(往返、解码、码率、丢帧)。
+4. 在专业页打开 NR / 超分 / 补帧,看画面能否正常增强。
+
+## 请记录并反馈
+
+- 登录是否成功;主机能否列出;从"开始串流"到出画面要几秒;
+- 画面分辨率(统计浮层第一行)、码率、延迟感受;手柄和震动是否正常;
+- 任何错误提示的原文、崩溃、卡死。
+- 日志:`logs\veyra-qml.log`,搜 `xbox`。连不上时,用环境变量 `VEYRA_XBOX_RTC_DEBUG=1` 启动一次(详细网络日志,含本机局域网地址,发给我前可以自行查看)。
+
+## 已知情况
+
+- **从未在真实账号和主机上测试过**:除了"微软能正常给出登录码"这一步,登录后的每一步都是第一次见真机。这正是本次要测的。
+- 只协商 H.264(参考客户端的做法),通常最高 1080p60,画质不如 PC 串流。
+- 不支持:键盘鼠标、多手柄、语音聊天、云游戏(xCloud)。
+- 断线不会自动重连,需要重新开始。
diff --git a/docs/UI_FIELD_FIXES_2026-10-01.md b/docs/UI_FIELD_FIXES_2026-10-01.md
new file mode 100644
index 00000000..28801b1b
--- /dev/null
+++ b/docs/UI_FIELD_FIXES_2026-10-01.md
@@ -0,0 +1,31 @@
+# 界面与切换问题修复(2026-10-01,beta 6)
+
+来源:用户在本机用 beta 5 试用后的 7 条反馈(截图 + `logs\veyra-qml.log`)。
+
+| # | 反馈 | 原因 | 修改 |
+|---|------|------|------|
+| 1 | 极简模式播放条空白处按住要能拖动窗口 | 播放条是独立的小窗口,没有处理拖动 | `CineBar.qml` 加 DragHandler(只在窗口化极简模式生效),按钮、进度条、音量条照常;拖动交给系统移动主窗口(`startSystemMove`,和顶栏胶囊一样) |
+| 2 | 全屏时点顶栏「专业模式」进不去 | 全屏只显示画面,换页后页面不显示,看起来没反应 | 全屏时从顶栏换到别的页,先退出全屏再换页(播放条菜单本来就是这样) |
+| 3 | 专业模式 GPU 阶段耗时条 0 / 5.8 / 0 / 5.8 来回跳 | 条的列表每次刷新(每秒 4 次)都是新数组,Repeater 整组重建,每根条都从 0 重新动画 | Repeater 改用条数做模型,每行按序号读当前值;条只在数值变化时平滑过渡 |
+| 4 | 负载预算百分比不准 | 实际显示的是"输出帧率 / 目标帧率",只要不掉帧就是 100%;设计时定的是"耗时 / 预算" | 改为增强链 GPU 耗时 P95 占一个源帧时间的比例(例:30 fps、NR 3.8 ms → 11%);超过 100% 表示跟不上源帧率。掉帧状态仍看下方状态灯 |
+| 5 | 先开采集卡再连 PS5,软件像卡住,有声音,过一会才出画面 | 日志:第一次连 PS5 主机 20 秒没连上(`connected=false`),这期间视频窗口一直留着采集卡最后一帧(采集卡接的正是 PS5,所以看起来像 PS5 画面卡住);PS5 连接没清掉上一次的会话号,"连接中"状态提前结束;再点连接时,没连上的旧会话又花了 18 秒才关掉 | 新片源打开期间,视频窗口的显示区域清空,露出黑底和"正在连接 PS5"提示,新画面出来后恢复;PS5 / PC / Xbox 三种串流连接都清掉旧会话号;引擎读当前串流会话改为在锁内取指针(原来与关闭过程有竞争) |
+| 6 | 极简模式什么都没打开时,点画面要弹出片源菜单 | 没有这个入口 | 空画面上点一下,在点击位置弹出片源菜单(与专业页「片源」按钮相同);提示文字改为"点击画面选择片源" |
+| 7 | 屏幕捕获竖屏窗口、打开竖屏视频,窗口超出屏幕 | 极简模式窗口高度 = 宽度 ÷ 画面比例,没有上限 | 画面高度不超过屏幕可用高度(留出播放条 46 px);放不下时窗口变窄并保持居中,底部超出时上移;之后打开横屏片源或离开极简模式,宽度恢复。极简模式最小宽度 360(顶栏约 330 宽);播放条至少 760 宽,竖屏时可以比画面宽,并保持在屏幕内 |
+
+## 验证
+
+- 构建:`veyra_qml_ui`、`veyra_qml_quick_tests`、`veyra_qml_easing_tests`、`veyra_qml_data_tests` 通过;三项 QML 测试全部通过。
+- 新增 `scripts/ui-check/ui-check.py` + `field-ui-20261001.qml`:用真实程序跑一遍,真实鼠标点击和拖动,截图在 `E:\项目\Veyra\tests\ui-fixes-20261001\run5\`,结果 PASS:
+ - 空画面点击 → 片源菜单打开(02);
+ - 720×1280 竖屏图片:窗口 748×1330,屏幕可用高 1392,播放条在屏幕内(03);
+ - 拖播放条空白处 −160 px → 窗口移动 −144 px(前 10 px 左右是拖动起步阈值)(04);
+ - 再打开横屏视频 → 宽度回到 1280(05);
+ - 开 NR 播放 30 fps 视频,3 秒内 32 次采样,每根耗时条宽度稳定(NR 3.1–3.3 px,无归零);负载预算 11%(旧算法会显示 100%)(06);
+ - 全屏 → 顶栏点专业 → 退出全屏并进入专业页(07)。
+- 第 5 条:日志确认每次切换来源都先清空视频窗口(`blank video until the new source presents`),新来源出画面后恢复。**没有连 PS5 实测**,慢连接期间的实际观感要你用 PS5 再试一次。
+
+## 未解决
+
+- 第 5 条里,没连上的 PS5 旧会话关闭要 18 秒,是串流库停止连接时在等它自己的超时;这段时间现在显示"正在连接",但第二次连接仍要等它关完。
+- 第一次 PS5 连接 20 秒没连上的原因看不出来(主机没有回应);如果经常这样,请再发日志。
+- 反馈里"有声音":日志里第一次连接期间 PS5 没有任何音频数据,采集卡音频也已停止,声音来源不明。
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index adf6dbad..69823bf6 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -1,5 +1,11 @@
# Veyra 工作记录
+## 2026-10-01 beta 5 试用反馈:界面与切换修复(分支 `codex/xbox-20261001`,beta 6)
+
+- 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 慢连接未实测(不连接用户主机)。
+- 同分支此前的串流与美乐威工作见 `docs/STREAM_FIELD_FIXES_2026-10-01.md`、`docs/MAGEWELL_LOW_LATENCY_2026-10-01.md`。
+
## 2026-10-01 2.0.0 合并 main 与分支整理
- 用户授权(“基本上 2.0.0 已经没啥问题了……先合并一手,存档一下,更新更新文档,对齐目前进度”):整理 2.0.0 各分支并合并到**本地** `main`;不含 push / Release / 删旧 UI / 删 worktree。
diff --git a/qml/Veyra/CineBar.qml b/qml/Veyra/CineBar.qml
index d43ff87a..d8986f90 100644
--- a/qml/Veyra/CineBar.qml
+++ b/qml/Veyra/CineBar.qml
@@ -17,6 +17,8 @@ Rectangle {
signal requestDialog(string key)
signal requestFullscreen()
signal requestLock()
+ // Windowed 极简: a drag on the pill's empty space moves the window, like a title bar.
+ signal requestMove()
// Set on the fullscreen bar: shows the lock button.
property bool fullscreen: false
// Set by FullscreenBar so upward menus stop above the playback pill.
@@ -27,6 +29,14 @@ Rectangle {
readonly property bool hovered: barHover.hovered
readonly property bool seekPreviewOpen: seekMouse.containsMouse && seekMouse.enabled
HoverHandler { id: barHover }
+ // Buttons, the seek rail and the volume slider take their own presses first; only
+ // a drag that starts on empty pill reaches this one.
+ DragHandler {
+ objectName: "cine-move"
+ target: null
+ enabled: !bar.fullscreen
+ onActiveChanged: if (active) bar.requestMove()
+ }
implicitHeight: 92
radius: 30
color: Qt.rgba(22 / 255, 22 / 255, 26 / 255, 0.86)
diff --git a/qml/Veyra/FullscreenBar.qml b/qml/Veyra/FullscreenBar.qml
index 66a673ff..7052b00b 100644
--- a/qml/Veyra/FullscreenBar.qml
+++ b/qml/Veyra/FullscreenBar.qml
@@ -22,6 +22,7 @@ Window {
signal requestDialog(string key)
signal requestFullscreen()
signal requestLock()
+ signal requestMove()
// Pointer movement over the bar keeps the controls up (the main window cannot
// see it here).
signal activity()
@@ -40,12 +41,18 @@ Window {
// Room for the pill plus the preset menu above it (VMenu is at most 420 tall).
readonly property int menuRoom: 440
- readonly property int barWidth: Math.min(860, owner.width - 48)
+ // At least 760: the transport needs the middle column. A portrait film's narrow
+ // window lets the pill reach past the picture's sides.
+ readonly property int barWidth: Math.min(860, Math.max(760, owner.width - 48))
width: barWidth
height: 92 + menuRoom
// Centred; fullscreen: 24px above the screen's bottom edge (the design's 24px
- // side margin); cinema: .cine-bar top = --pic-h - 46.
- x: owner.x + Math.round((owner.width - width) / 2)
+ // side margin); cinema: .cine-bar top = --pic-h - 46. Kept on the owner's screen.
+ x: {
+ const cx = owner.x + Math.round((owner.width - width) / 2)
+ const s = owner.screen
+ return s ? Math.max(s.virtualX, Math.min(cx, s.virtualX + s.width - width)) : cx
+ }
y: cinema ? owner.y + Math.round(pillTop) - menuRoom
: owner.y + owner.height - height - 24
@@ -101,6 +108,7 @@ Window {
onRequestDialog: k => win.requestDialog(k)
onRequestFullscreen: win.requestFullscreen()
onRequestLock: win.requestLock()
+ onRequestMove: win.requestMove()
HoverHandler {
// Real movement only: hover repeats while the bar animates.
property point last: Qt.point(-1, -1)
diff --git a/qml/Veyra/Main.qml b/qml/Veyra/Main.qml
index 542bb2ed..ba5e1644 100644
--- a/qml/Veyra/Main.qml
+++ b/qml/Veyra/Main.qml
@@ -20,7 +20,9 @@ Window {
id: root
width: 1280
height: 800
- minimumWidth: 720
+ // 极简 follows the film, and a portrait film needs a narrow window (the dock is
+ // about 330px wide).
+ minimumWidth: cinema ? 360 : 720
minimumHeight: 260
visible: true
color: "transparent"
@@ -34,10 +36,8 @@ Window {
property real nodeVideoHeight: 330
// Every navigation goes through here: "专业" means the node page while the
// node configuration is active, so the dock never drops into the list UI.
- function goPage(p) {
- if (p === "pro" && veyra.nodeMode === 1) p = "node"
- page = p
- }
+ function goPageTarget(p) { return p === "pro" && veyra.nodeMode === 1 ? "node" : p }
+ function goPage(p) { page = goPageTarget(p) }
// Test switches from the command line (main.cpp, G0.3); empty in normal use.
readonly property var test: typeof vyTest !== "undefined" ? vyTest : ({})
readonly property real testAspect: test.aspect !== undefined ? test.aspect : 0
@@ -64,11 +64,40 @@ Window {
onReportedAspectChanged: if (reportedAspect < 0.2) fitToFilm(16 / 9)
property string lastPage: "home"
property real heightBeforeCinema: 0
- readonly property real pictureHeight: Math.round(width / filmAspect)
+ // The tallest picture that still fits on the screen with the pill (46px) under
+ // it. A portrait video or a captured portrait window used to make the window
+ // taller than the screen (field report 2026-10-01).
+ readonly property real maxPictureHeight: {
+ const s = root.screen
+ return s ? Math.max(200, Math.min(s.height, s.desktopAvailableHeight) - 46 - 16) : 100000
+ }
+ readonly property real pictureHeight: Math.min(Math.round(width / filmAspect), maxPictureHeight)
+ // The width a tall film took away, given back when a wider film fits again.
+ property real widthBeforeNarrow: 0
function fitToFilm(aspect) {
if (aspect > 0.2 && aspect < 5.0) filmAspect = aspect
- if (cinema && !screenSized) height = Math.round(pictureHeight)
+ // The page, not `cinema`: onPageChanged calls this before that binding updates.
+ if (page !== "min" || screenSized) return
+ // Narrow the window for a film too tall for the screen, keeping its centre.
+ let w = widthBeforeNarrow > 0 ? widthBeforeNarrow : width
+ if (Math.round(w / filmAspect) > maxPictureHeight)
+ w = Math.max(minimumWidth, Math.round(maxPictureHeight * filmAspect))
+ if (Math.abs(w - width) >= 1) {
+ if (widthBeforeNarrow <= 0) widthBeforeNarrow = width
+ x += Math.round((width - w) / 2)
+ width = w
+ }
+ if (widthBeforeNarrow > 0 && w >= widthBeforeNarrow) widthBeforeNarrow = 0
+ height = Math.round(pictureHeight)
+ keepPillOnScreen()
+ }
+ // The pill hangs 46px below the picture: lift the window if that leaves the screen.
+ function keepPillOnScreen() {
+ const s = root.screen
+ if (!s) return
+ const bottom = s.virtualY + Math.min(s.height, s.desktopAvailableHeight)
+ if (y + pictureHeight + 46 + 8 > bottom) y = Math.max(s.virtualY, bottom - pictureHeight - 46 - 8)
}
// .vy.cine transition: height .7s var(--spring-soft)
Behavior on height {
@@ -102,8 +131,15 @@ Window {
// clears the cinema height on any other page).
const wasCinema = lastPage === "min"
lastPage = page
+ if (!screenSized && wasCinema && page !== "min" && widthBeforeNarrow > 0) {
+ // A tall film narrowed the window; the other pages get their width back.
+ x -= Math.round((widthBeforeNarrow - width) / 2)
+ width = widthBeforeNarrow
+ widthBeforeNarrow = 0
+ }
+ if (!screenSized && page !== "min" && width < 720) { x -= Math.round((720 - width) / 2); width = 720 }
if (screenSized) { /* the screen is the window */ }
- else if (page === "min") { if (!wasCinema) heightBeforeCinema = height; height = Math.round(pictureHeight) }
+ else if (page === "min") { if (!wasCinema) heightBeforeCinema = height; fitToFilm(filmAspect) }
else if (wasCinema && heightBeforeCinema >= 400) height = heightBeforeCinema
else if (height < 600) height = 800
// core.js app.go: the old page sinks (.22s) and the new one shows 150 ms
@@ -211,6 +247,7 @@ Window {
// takes no input (.page.leave { pointer-events: none }).
HomePage { pageId: "home"; onRequestPage: p => root.goPage(p) }
MinimalPage {
+ id: minPage
pageId: "min"
onRequestPage: p => root.goPage(p)
onRequestAspect: aspect => { if (root.testAspect <= 0) root.fitToFilm(aspect) }
@@ -266,7 +303,12 @@ Window {
locked: root.fullLocked
forcedTip: root.test.tip !== undefined ? root.test.tip : ""
opened: pinned
- onRequestPage: p => root.goPage(p)
+ // In fullscreen only the picture is on screen, so another page (专业 above all)
+ // would change nothing visible: leave fullscreen first, as the pill's menu does.
+ onRequestPage: p => {
+ if (root.fullscreen && root.goPageTarget(p) !== root.page) root.toggleFullscreen()
+ root.goPage(p)
+ }
onRequestMinimize: root.showMinimized()
onRequestMaximize: root.toggleMaximized()
onRequestClose: root.close()
@@ -450,6 +492,7 @@ Window {
onRequestDialog: k => dialogs.open(k)
onRequestFullscreen: root.toggleFullscreen()
onRequestLock: root.toggleLock()
+ onRequestMove: if (!root.fullscreen && !root.maximized) root.startSystemMove()
onActivity: root.pointerActivity()
}
function toggleLock() {
@@ -662,5 +705,9 @@ Window {
// --full-bar shown|hidden: enter fullscreen with the control window held shown
// or held hidden, for the present-timing comparison (G2.5).
Timer { id: testFullTimer; interval: 1500; onTriggered: { root.toggleFullscreen(); if (root.test.fullBar === "hidden") root.fullControls = false } }
- Timer { id: testMenuTimer; interval: 600; onTriggered: proPage.openTestMenu(root.test.menu) }
+ Timer {
+ id: testMenuTimer
+ interval: 600
+ onTriggered: root.test.menu === "min-source" ? minPage.openSourceMenuForTest() : proPage.openTestMenu(root.test.menu)
+ }
}
diff --git a/qml/Veyra/MinimalPage.qml b/qml/Veyra/MinimalPage.qml
index f7dfb409..50f412f5 100644
--- a/qml/Veyra/MinimalPage.qml
+++ b/qml/Veyra/MinimalPage.qml
@@ -63,12 +63,24 @@ VPage {
Text {
anchors.centerIn: parent
- visible: !veyra.hasSource && veyra.liveOpeningText.length === 0
- text: "选择一个片源开始"
+ visible: stageTap.enabled
+ text: "点击画面选择片源"
color: Theme.t3
font.family: Theme.fontUi
font.pixelSize: Theme.fsH3
}
+ // Nothing open: a click on the empty picture opens the source menu where it
+ // was clicked (the same menu as the professional page's 片源 button).
+ Item { id: menuAnchor; width: 1; height: 1 }
+ TapHandler {
+ id: stageTap
+ enabled: !veyra.hasSource && veyra.liveOpeningText.length === 0
+ onTapped: eventPoint => {
+ menuAnchor.x = eventPoint.position.x
+ menuAnchor.y = eventPoint.position.y
+ sourceMenu.openAt(menuAnchor, "at")
+ }
+ }
// A PS5 / capture session that is still connecting: a pill in the
// middle of the (still black) picture, cut out of the native video.
Rectangle {
@@ -99,6 +111,30 @@ VPage {
}
}
+ VMenu {
+ id: sourceMenu
+ objectName: "min-source-menu"
+ title: "片源"
+ items: [{ label: "打开文件…", icon: "folder", act: "file" },
+ { label: "PS5 串流…", icon: "gamepad", act: "ps5" },
+ { label: "PC 串流…", icon: "cast", act: "moonlight" },
+ { label: "Xbox 串流…", icon: "gamepad", act: "xbox" },
+ { label: "屏幕捕获…", icon: "monitor", act: "screen" },
+ { sep: true },
+ { label: "采集卡设置…", icon: "settings", act: "capture" }]
+ onPicked: (i, o) => {
+ if (o.act === "file") veyra.openFileDialog()
+ else if (o.act === "ps5") veyra.openPs5Dialog()
+ else if (o.act === "moonlight") veyra.openMoonlightDialog()
+ else if (o.act === "xbox") veyra.openXboxDialog()
+ else if (o.act === "screen") veyra.openScreenCaptureDialog()
+ else if (o.act === "capture") veyra.openCaptureDialog()
+ }
+ }
+ readonly property bool sourceMenuOpen: sourceMenu.visible
+ function closeSourceMenu() { sourceMenu.close() }
+ function openSourceMenuForTest() { menuAnchor.x = width / 2; menuAnchor.y = pictureHeight / 2; sourceMenu.openAt(menuAnchor, "at") }
+
// Report the film aspect upward so the window can snap to it.
onPictureHeightChanged: if (veyra.sourceAspect > 0.2) root.requestAspect(veyra.sourceAspect)
signal requestAspect(real aspect)
diff --git a/qml/Veyra/ProPage.qml b/qml/Veyra/ProPage.qml
index ecf42ad1..18361d55 100644
--- a/qml/Veyra/ProPage.qml
+++ b/qml/Veyra/ProPage.qml
@@ -246,15 +246,18 @@ VPage {
label: "GPU 占用"
tip: "Windows GPU 引擎占用率(最忙的引擎类型,全系统),每秒采样"
}
+ // How much of one source frame's time the enhancement chain uses (the plan's
+ // "负载预算 = 耗时 / 预算"). It used to show output fps / target fps, which
+ // reads 100% whenever the output keeps up, however light the load.
PerfOrb {
size: parent.size
showLabel: parent.showLabels
- known: veyra.outputRateRatio >= 0
- // Full ring = on target; a shortfall shows as a gap and turns amber/red.
- fraction: known ? (veyra.outputRateRatio >= 0.95 ? 0.5 : veyra.outputRateRatio >= 0.8 ? 0.85 : 1.1) : 0
- value: known ? Math.round(Math.min(1.5, veyra.outputRateRatio) * 100) + "%" : "—"
+ known: veyra.chainTotalMsKnown && veyra.stageBudgetMs > 0
+ fraction: known ? veyra.chainTotalMs / veyra.stageBudgetMs : 0
+ value: known ? Math.round(veyra.chainTotalMs / veyra.stageBudgetMs * 100) + "%" : "—"
label: "负载预算"
- tip: "实际输出帧率 / 目标帧率(源帧率 × 补帧倍率):" + veyra.runStatus
+ tip: "增强链 GPU 耗时 P95 占一个源帧时间(" + veyra.stageBudgetMs.toFixed(1)
+ + " ms)的比例;超过 100% 就跟不上源帧率。当前状态:" + veyra.runStatus
}
}
// The status light: 1.4.4's 当前状态 (正常 / 补帧调度降档 / 输出未达标 /
@@ -691,12 +694,15 @@ VPage {
rowSpacing: 6
flow: GridLayout.TopToBottom
rows: Math.ceil(veyra.stageTimings.length / 2)
+ // The model is the row count, not the list: the list is a new array on
+ // every snapshot, and a list model rebuilt the rows each time, so every
+ // bar restarted from 0 (the 0 / 5.8 / 0 / 5.8 flicker in the field).
Repeater {
- model: veyra.stageTimings
+ model: veyra.stageTimings.length
delegate: RowLayout {
id: stageRow
- required property var modelData
required property int index
+ readonly property var modelData: veyra.stageTimings[index] || ({ label: "", ms: 0, fraction: 0, measured: false, color: "transparent" })
Layout.fillWidth: true
Layout.preferredWidth: 1
spacing: 8
@@ -718,6 +724,7 @@ VPage {
radius: 9
color: Qt.rgba(1, 1, 1, 0.08)
Rectangle {
+ objectName: "stage-bar-fill"
width: root.barsArmed ? parent.width * Math.max(0, Math.min(1, modelData.fraction)) : 0
height: parent.height
radius: 9
diff --git a/scripts/moonlight/make-beta.py b/scripts/moonlight/make-beta.py
index 3b3587e8..732343c3 100644
--- a/scripts/moonlight/make-beta.py
+++ b/scripts/moonlight/make-beta.py
@@ -42,7 +42,7 @@ shutil.copytree(build / 'qml/Veyra', pkg / 'qml/Veyra')
for name in ('LICENSE', 'THIRD_PARTY_NOTICES.md'):
shutil.copy2(repo / name, pkg / name)
(pkg / 'docs').mkdir(exist_ok=True)
-for name in ('MOONLIGHT_EXECUTION_2026-10-01.md', 'STREAMING_PLAN_MOONLIGHT_XBOX_2026-10-01.md', 'XBOX_EXECUTION_2026-10-01.md', 'STREAM_FIELD_FIXES_2026-10-01.md', 'MAGEWELL_LOW_LATENCY_2026-10-01.md'):
+for name in ('MOONLIGHT_EXECUTION_2026-10-01.md', 'STREAMING_PLAN_MOONLIGHT_XBOX_2026-10-01.md', 'XBOX_EXECUTION_2026-10-01.md', 'STREAM_FIELD_FIXES_2026-10-01.md', 'MAGEWELL_LOW_LATENCY_2026-10-01.md', 'UI_FIELD_FIXES_2026-10-01.md'):
if (repo / 'docs' / name).exists():
shutil.copy2(repo / 'docs' / name, pkg / 'docs' / name)
shutil.copy2(repo / notes, pkg / '测试说明.md')
diff --git a/scripts/ui-check/field-ui-20261001.qml b/scripts/ui-check/field-ui-20261001.qml
new file mode 100644
index 00000000..2880d58f
--- /dev/null
+++ b/scripts/ui-check/field-ui-20261001.qml
@@ -0,0 +1,105 @@
+
+ // ---- field UI fixes 2026-10-01 (scripts/ui-check/ui-check.py) ----------------------
+ // Needs --page min. Opens a portrait PNG and a landscape video (file URLs given to
+ // ui-check.py as PORTRAIT=... LANDSCAPE=...).
+ readonly property var uiFiles: ["@PORTRAIT@", "@LANDSCAPE@"]
+ property int uiStep: 0
+ property bool uiFailed: false
+ property var uiStart: ({})
+ property var uiSamples: []
+ function uiLog(m) { veyra.logUi("uitest", m) }
+ function uiFail(m) { uiFailed = true; uiLog("UITEST_FAIL " + m) }
+ function uiFind(item, name, out) {
+ if (item.objectName === name) out.push(item)
+ for (const c of item.children) uiFind(c, name, out)
+ return out
+ }
+ function uiGeometry(tag) {
+ const s = root.screen
+ uiLog("UITEST_NOTE " + tag + " window=" + root.x + "," + root.y + " " + root.width + "x" + root.height
+ + " picture=" + root.pictureHeight + " max=" + root.maxPictureHeight + " aspect=" + root.filmAspect.toFixed(4)
+ + " screen=" + (s ? s.virtualX + "," + s.virtualY + " " + s.width + "x" + s.height + " avail=" + s.desktopAvailableHeight : "?")
+ + " page=" + root.page + " fullscreen=" + root.fullscreen)
+ }
+ Timer { interval: 150; running: true; repeat: true; onTriggered: veyra.logUi("uitest-tick", "") }
+ Timer {
+ id: uiSampler
+ interval: 100
+ repeat: true
+ onTriggered: root.uiSamples.push(root.uiFind(proPage, "stage-bar-fill", []).map(b => b.width))
+ }
+ readonly property var uiSteps: [
+ [1800, () => { if (root.page !== "min") return uiFail("start page " + root.page); uiLog("UITEST_SHOT 01-min-empty") }],
+ [1200, () => { const p = minPage.mapToGlobal(minPage.width / 2, root.pictureHeight * 0.7); uiLog("UITEST_CLICK " + p.x + " " + p.y) }],
+ [1200, () => { if (!minPage.sourceMenuOpen) return uiFail("a click on the empty picture did not open the source menu"); uiLog("UITEST_SHOT 02-min-menu") }],
+ [900, () => { minPage.closeSourceMenu(); veyra.openUrl(root.uiFiles[0]) }],
+ [3500, () => {
+ uiGeometry("portrait")
+ const s = root.screen
+ const bottom = s.virtualY + Math.min(s.height, s.desktopAvailableHeight)
+ if (root.height > root.maxPictureHeight + 1) return uiFail("portrait window taller than the screen allows: " + root.height)
+ if (root.y + root.height + 46 > bottom + 1) return uiFail("portrait pill below the screen: y=" + root.y + " h=" + root.height)
+ if (Math.abs(root.height - root.width / root.filmAspect) > 2) return uiFail("portrait picture does not fill the window width")
+ uiLog("UITEST_SHOT 03-portrait")
+ }],
+ [900, () => {
+ if (!fullBar.visible) return uiFail("cinema pill not shown")
+ root.uiStart = { x: root.x, y: root.y }
+ const x = fullBar.x + 16 + 220, y = fullBar.y + fullBar.menuRoom + 84
+ // Left and up: the window sits on the screen's lower edge after the portrait fit.
+ uiLog("UITEST_DRAG " + x + " " + y + " " + (x - 160) + " " + (y - 40))
+ }],
+ [1800, () => {
+ uiGeometry("dragged")
+ // The drag threshold (about 10px) is not part of the move.
+ const dx = root.x - root.uiStart.x, dy = root.y - root.uiStart.y
+ if (dx > -140 || dx < -170 || (root.uiStart.y > 60 && (dy > -20 || dy < -50)))
+ return uiFail("dragging the pill moved the window by " + dx + "," + dy)
+ uiLog("UITEST_SHOT 04-dragged")
+ }],
+ [900, () => veyra.openUrl(root.uiFiles[1])],
+ [3500, () => {
+ uiGeometry("landscape")
+ if (root.width < 1000) return uiFail("landscape film did not get the width back: " + root.width)
+ uiLog("UITEST_SHOT 05-landscape")
+ }],
+ // NR on, so the stage bars carry real GPU time (the field case: NR 5.8 ms).
+ [900, () => { veyra.nrEnabled = true; veyra.seekTo(0); if (veyra.paused) veyra.togglePlayPause(); root.goPage("pro") }],
+ [6000, () => { root.uiSamples = []; uiSampler.start() }],
+ [3200, () => {
+ uiSampler.stop()
+ const n = root.uiSamples.length ? root.uiSamples[0].length : 0
+ let summary = []
+ for (let i = 0; i < n; ++i) {
+ const w = root.uiSamples.map(row => row[i])
+ const lo = Math.min(...w), hi = Math.max(...w)
+ summary.push(lo.toFixed(1) + "-" + hi.toFixed(1))
+ if (hi > 0.5 && lo < hi * 0.5) return uiFail("stage bar " + i + " jumps between " + lo + " and " + hi)
+ }
+ uiLog("UITEST_NOTE bars samples=" + root.uiSamples.length + " widths(min-max)=" + summary.join(" ")
+ + " chainTotalMs=" + veyra.chainTotalMs.toFixed(2) + " budgetMs=" + veyra.stageBudgetMs.toFixed(2)
+ + " load=" + (veyra.stageBudgetMs > 0 ? Math.round(veyra.chainTotalMs / veyra.stageBudgetMs * 100) : -1) + "%"
+ + " outputRatio=" + veyra.outputRateRatio.toFixed(3) + " nrActive=" + veyra.nrActive
+ + " position=" + veyra.position.toFixed(1) + "/" + veyra.duration.toFixed(1))
+ uiLog("UITEST_SHOT 06-pro")
+ }],
+ [900, () => { root.goPage("min"); root.toggleFullscreen() }],
+ [2000, () => { uiGeometry("fullscreen"); if (!root.fullscreen) return uiFail("fullscreen did not start"); dock.requestPage("pro") }],
+ [1800, () => {
+ uiGeometry("after dock")
+ if (root.fullscreen || (root.page !== "pro" && root.page !== "node")) return uiFail("dock 专业 in fullscreen: page=" + root.page + " fullscreen=" + root.fullscreen)
+ uiLog("UITEST_SHOT 07-pro-from-fullscreen")
+ }],
+ [1200, () => uiLog("UITEST_DONE")]
+ ]
+ Timer {
+ id: uiRun
+ running: true
+ interval: root.uiSteps[0][0]
+ onTriggered: {
+ const step = root.uiSteps[root.uiStep]
+ step[1]()
+ root.uiStep += 1
+ if (!root.uiFailed && root.uiStep < root.uiSteps.length) { interval = root.uiSteps[root.uiStep][0]; restart() }
+ }
+ }
diff --git a/scripts/ui-check/ui-check.py b/scripts/ui-check/ui-check.py
new file mode 100644
index 00000000..fdd3b9dc
--- /dev/null
+++ b/scripts/ui-check/ui-check.py
@@ -0,0 +1,185 @@
+"""Drives the player through a QML test snippet and takes screen shots (no hardware, no network).
+
+usage: python ui-check.py <staged-app-dir> <out-dir> <snippet.qml> [KEY=VALUE ...] [app arguments ...]
+
+KEY=VALUE replaces @KEY@ in the snippet (file URLs and the like).
+
+The snippet is appended inside the staged Main.qml (restored afterwards) and talks to this script
+through log lines:
+ UITEST_SHOT <name> screen shot of the main window plus the 60px below it (the pill)
+ UITEST_CLICK <x> <y> a left click at screen coordinates
+ UITEST_DRAG <x0> <y0> <x1> <y1> a left-button drag at screen coordinates
+ UITEST_DONE / UITEST_FAIL <why> the verdict
+The log is flushed by the next log call, so the snippet keeps a heartbeat going.
+Clicks and drags move the real pointer for about a second.
+"""
+import ctypes
+import os
+import subprocess
+import sys
+import time
+from pathlib import Path
+
+app, out, snippet_path = Path(sys.argv[1]), Path(sys.argv[2]), Path(sys.argv[3])
+defines = dict(a.split('=', 1) for a in sys.argv[4:] if '=' in a and not a.startswith('-'))
+extra = [a for a in sys.argv[4:] if not ('=' in a and not a.startswith('-'))]
+out.mkdir(parents=True, exist_ok=True)
+work = out / 'work'
+work.mkdir(exist_ok=True)
+
+main = app / 'qml/Veyra/Main.qml'
+original = main.read_bytes()
+source = original.decode('utf-8-sig')
+index = source.rfind('}')
+snippet = snippet_path.read_text(encoding='utf8')
+for key, value in defines.items():
+ snippet = snippet.replace('@' + key + '@', value)
+main.write_text(source[:index] + snippet + source[index:], encoding='utf8')
+
+user32 = ctypes.windll.user32
+MOUSEEVENTF_LEFTDOWN, MOUSEEVENTF_LEFTUP = 0x0002, 0x0004
+
+
+class RECT(ctypes.Structure):
+ _fields_ = [('l', ctypes.c_long), ('t', ctypes.c_long), ('r', ctypes.c_long), ('b', ctypes.c_long)]
+
+
+def main_window(pid):
+ found = []
+
+ @ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.c_void_p, ctypes.c_void_p)
+ def visit(hwnd, _):
+ owner = ctypes.c_ulong()
+ user32.GetWindowThreadProcessId(hwnd, ctypes.byref(owner))
+ if owner.value == pid and user32.IsWindowVisible(hwnd) and not user32.IsIconic(hwnd):
+ rect = RECT()
+ user32.GetWindowRect(hwnd, ctypes.byref(rect))
+ found.append((hwnd, rect))
+ return True
+ user32.EnumWindows(visit, 0)
+ found.sort(key=lambda w: (w[1].r - w[1].l) * (w[1].b - w[1].t), reverse=True)
+ return found[0] if found else None
+
+
+def windows_of(pid):
+ found = []
+
+ @ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.c_void_p, ctypes.c_void_p)
+ def visit(hwnd, _):
+ owner = ctypes.c_ulong()
+ user32.GetWindowThreadProcessId(hwnd, ctypes.byref(owner))
+ if owner.value == pid and user32.IsWindowVisible(hwnd):
+ found.append(hwnd)
+ return True
+ user32.EnumWindows(visit, 0)
+ return found
+
+
+def raise_app(pid, on):
+ # Topmost for the shot only, so whatever else is on screen (a terminal, the IDE) is not in it.
+ HWND_TOPMOST, HWND_NOTOPMOST, flags = -1, -2, 0x0001 | 0x0002 | 0x0010 # NOSIZE | NOMOVE | NOACTIVATE
+ # Largest first: each call goes to the top, so the pill and popups end above the main window.
+ def area(hwnd):
+ rect = RECT()
+ user32.GetWindowRect(ctypes.c_void_p(hwnd), ctypes.byref(rect))
+ return (rect.r - rect.l) * (rect.b - rect.t)
+ for hwnd in sorted(windows_of(pid), key=area, reverse=True):
+ user32.SetWindowPos(ctypes.c_void_p(hwnd), ctypes.c_void_p(HWND_TOPMOST if on else HWND_NOTOPMOST), 0, 0, 0, 0, flags)
+
+
+def shot(pid, path):
+ win = main_window(pid)
+ if not win:
+ return False
+ _, r = win
+ raise_app(pid, True)
+ time.sleep(0.3)
+ # Screen pixels: the picture is a native D3D window and the pill is a window of its own.
+ try:
+ from PIL import ImageGrab
+ ImageGrab.grab(bbox=(r.l, r.t, r.r, r.b + 60), all_screens=True).save(str(path))
+ finally:
+ raise_app(pid, False)
+ return True
+
+
+def move(x, y):
+ user32.SetCursorPos(int(x), int(y))
+
+
+def click(x, y):
+ move(x, y)
+ time.sleep(0.15)
+ user32.mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
+ time.sleep(0.06)
+ user32.mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
+
+
+def drag(x0, y0, x1, y1):
+ move(x0, y0)
+ time.sleep(0.15)
+ user32.mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
+ for i in range(1, 31):
+ time.sleep(0.02)
+ move(x0 + (x1 - x0) * i / 30, y0 + (y1 - y0) * i / 30)
+ time.sleep(0.15)
+ user32.mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
+
+
+result = 1
+proc = None
+try:
+ log = out / 'app.log'
+ if log.exists():
+ log.unlink()
+ env = os.environ.copy()
+ env.update(VEYRA_LOG_FILE=str(log), QML_DISABLE_DISK_CACHE='1', QML2_IMPORT_PATH=str(app / 'qml'),
+ TEMP=str(work), TMP=str(work))
+ command = [str(app / 'veyra_qml_ui.exe'), '--data-dir', str(work / 'profile'), '--exit-after', '280000'] + extra
+ proc = subprocess.Popen(command, cwd=app, env=env, stdout=(out / 'stdio.log').open('w'), stderr=subprocess.STDOUT)
+ seen = 0
+ verdict = None
+ deadline = time.time() + 290
+ while time.time() < deadline and verdict is None:
+ time.sleep(0.1)
+ lines = log.read_text(encoding='utf8', errors='replace').splitlines() if log.exists() else []
+ for line in lines[seen:]:
+ if 'UITEST_SHOT ' in line:
+ name = line.split('UITEST_SHOT ')[1].strip()
+ time.sleep(0.2)
+ print('shot', name, 'ok' if shot(proc.pid, out / f'{name}.png') else 'NO WINDOW')
+ elif 'UITEST_CLICK ' in line:
+ x, y = (float(v) for v in line.split('UITEST_CLICK ')[1].split()[:2])
+ raise_app(proc.pid, True)
+ time.sleep(0.3)
+ try:
+ click(x, y)
+ finally:
+ raise_app(proc.pid, False)
+ elif 'UITEST_DRAG ' in line:
+ x0, y0, x1, y1 = (float(v) for v in line.split('UITEST_DRAG ')[1].split()[:4])
+ raise_app(proc.pid, True)
+ time.sleep(0.3)
+ try:
+ drag(x0, y0, x1, y1)
+ finally:
+ raise_app(proc.pid, False)
+ elif 'UITEST_NOTE ' in line:
+ print(line.split('UITEST_NOTE ', 1)[1].strip())
+ elif 'UITEST_FAIL' in line:
+ verdict = 'FAIL ' + line.split('UITEST_FAIL', 1)[1].strip()
+ elif 'UITEST_DONE' in line:
+ verdict = 'PASS'
+ seen = len(lines)
+ if proc.poll() is not None and verdict is None:
+ time.sleep(0.5)
+ lines = log.read_text(encoding='utf8', errors='replace').splitlines() if log.exists() else []
+ if not any('UITEST_DONE' in l for l in lines[seen:]):
+ verdict = 'FAIL app exited with code %s' % proc.returncode
+ print('RESULT', verdict)
+ result = 0 if verdict == 'PASS' else 1
+finally:
+ main.write_bytes(original)
+ if proc and proc.poll() is None:
+ proc.kill()
+sys.exit(result)
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index e6035898..3bc6f4d2 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -198,7 +198,28 @@ PlayerSnapshot EngineController::snapshot()const{
// (sweep 2026-09-22 B3). Consecutive UI callers within 50 ms share one
// flow snapshot.
PlayerSnapshot copy;std::shared_ptr<FrameFlowWindow> flowWindow;
- {std::lock_guard lock(mutex_);copy=snapshot_;copy.presentation=presentation_;flowWindow=activeFlow_;}
+ // The session pointers are copied under the lock: teardown resets them on the
+ // engine thread while the UI polls.
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ std::shared_ptr<source::RemotePlaySessionSource> activeRemote;
+#endif
+#ifdef VEYRA_ENABLE_MOONLIGHT
+ std::shared_ptr<source::MoonlightSessionSource> activeMoonlight;
+#endif
+#ifdef VEYRA_ENABLE_XBOX
+ std::shared_ptr<source::XboxSessionSource> activeXbox;
+#endif
+ {std::lock_guard lock(mutex_);copy=snapshot_;copy.presentation=presentation_;flowWindow=activeFlow_;
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ activeRemote=activeRemote_;
+#endif
+#ifdef VEYRA_ENABLE_MOONLIGHT
+ activeMoonlight=activeMoonlight_;
+#endif
+#ifdef VEYRA_ENABLE_XBOX
+ activeXbox=activeXbox_;
+#endif
+ }
copy.volume=volume_;copy.muted=muted_;
const bool playing=copy.running&&!copy.image&&copy.transport==TransportState::Playing;
if(flowWindow){
@@ -210,24 +231,24 @@ PlayerSnapshot EngineController::snapshot()const{
}
copy.fgBudgetLimited=playing&&copy.metrics.flow.lastFgRejected100ns>0&&monotonic100ns()-copy.metrics.flow.lastFgRejected100ns<10000000;
#ifdef VEYRA_ENABLE_REMOTEPLAY
- if(copy.remotePlay&&activeRemote_){
- const auto s=activeRemote_->sessionSnapshot();copy.remoteStream=s;copy.remotePlayState=int(s.state);
- const auto recovery=activeRemote_->recoveryStatus();copy.remoteRecovering=recovery.active;copy.remoteReconnectAttempts=recovery.attempts;copy.remoteRecoveryMessage=recovery.message;
+ if(copy.remotePlay&&activeRemote){
+ const auto s=activeRemote->sessionSnapshot();copy.remoteStream=s;copy.remotePlayState=int(s.state);
+ const auto recovery=activeRemote->recoveryStatus();copy.remoteRecovering=recovery.active;copy.remoteReconnectAttempts=recovery.attempts;copy.remoteRecoveryMessage=recovery.message;
copy.remoteReceivedFps=s.receivedFps;copy.remoteDecodedFps=s.decodedFps;copy.remoteRatesReady=s.ratesReady;
copy.remoteReceived=s.video.accessUnits;copy.remoteDecoded=s.decodedFrames;copy.remoteIngressDropped=s.video.dropped;
- copy.remotePlaySkipped=activeRemote_->skipped();copy.captureAudio=activeRemote_->audioState();copy.audioAvailable=copy.captureAudio.available;
+ copy.remotePlaySkipped=activeRemote->skipped();copy.captureAudio=activeRemote->audioState();copy.audioAvailable=copy.captureAudio.available;
}
#endif
#ifdef VEYRA_ENABLE_MOONLIGHT
- if(copy.moonlightActive&&activeMoonlight_){
- copy.moonlight=activeMoonlight_->stats();
- copy.captureAudio=activeMoonlight_->audioState();copy.audioAvailable=copy.captureAudio.available;
+ if(copy.moonlightActive&&activeMoonlight){
+ copy.moonlight=activeMoonlight->stats();
+ copy.captureAudio=activeMoonlight->audioState();copy.audioAvailable=copy.captureAudio.available;
}
#endif
#ifdef VEYRA_ENABLE_XBOX
- if(copy.xboxActive&&activeXbox_){
- copy.xbox=activeXbox_->stats();
- copy.captureAudio=activeXbox_->audioState();copy.audioAvailable=copy.captureAudio.available;
+ if(copy.xboxActive&&activeXbox){
+ copy.xbox=activeXbox->stats();
+ copy.captureAudio=activeXbox->audioState();copy.audioAvailable=copy.captureAudio.available;
}
#endif
auto& flow=copy.metrics.flow;
diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cpp
index 3c468f2d..d1e2204e 100644
--- a/src/ui/QmlPlayerBridge.cpp
+++ b/src/ui/QmlPlayerBridge.cpp
@@ -1752,6 +1752,7 @@ void QmlPlayerBridge::setupXbox() {
if (!j.videoWindow) return false;
rememberPosition(true);
j.openingSource = true;
+ j.openingSessionId = 0;
j.sourceLabel = L"Xbox · " + launch.label.toStdWString();
j.resumeSession = 0;
j.screenFillActive = false;
@@ -1854,6 +1855,7 @@ void QmlPlayerBridge::setupMoonlight() {
if (!j.videoWindow) return false;
rememberPosition(true);
j.openingSource = true;
+ j.openingSessionId = 0;
j.sourceLabel = L"PC · " + launch.label.toStdWString();
j.resumeSession = 0;
j.screenFillActive = false;
@@ -2097,7 +2099,9 @@ bool QmlPlayerBridge::ps5Connect() {
WritePrivateProfileStringW(L"RemotePlay", L"FineSampling", desc.highQualitySampling ? L"1" : L"0", ps5Settings().c_str());
const bool viewOnly = desc.request.viewOnly;
rememberPosition(true);
- i.openingSource = true; i.sourceLabel = L"PS5 · " + std::wstring(host.begin(), host.end()); i.resumeSession = 0; i.screenFillActive = false;
+ // The session id is cleared with the flag: the previous session's id left over here
+ // ended "opening" on the next snapshot while the old source still ran.
+ i.openingSource = true; i.openingSessionId = 0; i.sourceLabel = L"PS5 · " + std::wstring(host.begin(), host.end()); i.resumeSession = 0; i.screenFillActive = false;
auto request = std::make_shared<source::RemotePlayConnectDesc>(std::move(desc));
openAfterCinema(tr("正在连接 PS5 · %1").arg(QString::fromStdString(host)), [this, request, viewOnly] {
auto& i = *impl_;