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

feat(ui-mig): G2.3 video window follows rendered frames instead of a 16 ms timer

Veyra Goal Agent8a4d49680edc
diff --git a/apps/veyra-qml/main.cpp b/apps/veyra-qml/main.cpp
index 346b7285..0fc53fe0 100644
--- a/apps/veyra-qml/main.cpp
+++ b/apps/veyra-qml/main.cpp
@@ -16,6 +16,7 @@
#include <QQuickItem>
#include <QQuickWindow>
#include <QTimer>
+#include <QPointer>
#include <QVariantMap>
#include <QList>
#include <QRect>
@@ -85,6 +86,11 @@ void syncVideoGeometry(QQuickWindow* window, QQuickItem* host) {
const int y = int(std::floor(topLeft.y() * dpr));
const int w = std::max(1, int(std::floor(host->width() * dpr)));
const int h = std::max(1, int(std::floor(host->height() * dpr)));
+ // Called every rendered frame: only a changed rect reaches the window manager,
+ // so a moving popover never makes the presenter see a spurious resize.
+ static RECT last{-1, -1, -1, -1};
+ if (IsWindowVisible(g_video) && last.left == x && last.top == y && last.right == w && last.bottom == h) return;
+ last = RECT{x, y, w, h};
SetWindowPos(g_video, HWND_TOP, x, y, w, h, SWP_NOACTIVATE | SWP_SHOWWINDOW);
}
@@ -274,43 +280,46 @@ int main(int argc, char** argv) {
// Reparent the native window under the QML window and keep it in step. The
// host item is looked up by objectName so the QML side owns the layout and
// this side only follows it.
- // The host item's geometry is followed on a timer rather than through change
- // signals. Signals only fire when a value changes, and the first layout pass
- // can leave the host at its default (0x0) with no change to observe, which
- // is how the engine ended up building a swapchain from a 1x1 window.
- auto* follow = new QTimer(&app);
- QObject::connect(follow, &QTimer::timeout, &app, [window] {
+ // The host item is followed per rendered frame rather than on a timer or through
+ // its own change signals. afterAnimating fires on the GUI thread before every
+ // frame Qt produces, so anything that moves the host (layout, a resize, the
+ // page switch, a cinema height animation, a popover scaling in) is picked up in
+ // the same frame, and an idle scene renders no frames and costs nothing. Change
+ // signals alone were not enough: the first layout pass can leave the host at its
+ // default 0x0 with no change to observe, which is how the engine once built a
+ // swapchain from a 1x1 window. The native calls only run when a value changed.
+ auto follow = [window] {
if (!g_video) return;
- // Report the search itself until it succeeds: "the log is silent" and
- // "the lookup failed" look identical otherwise, and that ambiguity cost
- // a round of guessing already.
- static int ticks = 0;
- ++ticks;
- if (ticks < 3 || ticks % 120 == 0) {
- auto* found = window->findChild<QQuickItem*>(QStringLiteral("videoHost"));
- veyra::log::info("qml", std::format("video host lookup: found={} contentChildren={}",
- found != nullptr,
- window->contentItem() ? window->contentItem()->childItems().size() : -1));
- }
// Safety net: the pre-open hook parents the window before the engine reads
// its size, but a resize before any open must also keep it in place.
if (GetParent(g_video) == nullptr)
SetParent(g_video, reinterpret_cast<HWND>(window->winId()));
- if (auto* host = window->findChild<QQuickItem*>(QStringLiteral("videoHost"))) {
- // Report the resolved geometry once at each distinct size, so the log
- // says what the video window was actually given.
- static int lastW = -1, lastH = -1;
- const int w = int(host->width()), h = int(host->height());
- if (w != lastW || h != lastH) {
- lastW = w; lastH = h;
- veyra::log::info("qml", std::format("video host geometry {}x{} at {},{}",
- w, h, int(host->x()), int(host->y())));
- }
- syncVideoGeometry(window, host);
- syncVideoCovers(window, host);
+ static QPointer<QQuickItem> host;
+ if (!host) {
+ host = window->findChild<QQuickItem*>(QStringLiteral("videoHost"));
+ // Report the search: "the log is silent" and "the lookup failed" look
+ // identical otherwise.
+ veyra::log::info("qml", std::format("video host lookup: found={} contentChildren={}",
+ host != nullptr,
+ window->contentItem() ? window->contentItem()->childItems().size() : -1));
+ if (!host) return;
}
- });
- follow->start(16);
+ // Report the resolved geometry once at each distinct size, so the log
+ // says what the video window was actually given.
+ static int lastW = -1, lastH = -1;
+ const int w = int(host->width()), h = int(host->height());
+ if (w != lastW || h != lastH) {
+ lastW = w; lastH = h;
+ veyra::log::info("qml", std::format("video host geometry {}x{} at {},{}",
+ w, h, int(host->x()), int(host->y())));
+ }
+ syncVideoGeometry(window, host);
+ syncVideoCovers(window, host);
+ };
+ QObject::connect(window, &QQuickWindow::afterAnimating, &app, follow);
+ // The first frame may come before the page layout settles; one pass after the
+ // event loop starts covers a scene that then never animates.
+ QTimer::singleShot(0, &app, follow);
// 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/UI_FULL_GOAL_PLAN_2026-09-26.md b/docs/UI_FULL_GOAL_PLAN_2026-09-26.md
index 4d7f38ce..ab229149 100644
--- a/docs/UI_FULL_GOAL_PLAN_2026-09-26.md
+++ b/docs/UI_FULL_GOAL_PLAN_2026-09-26.md
@@ -11,7 +11,7 @@
|---|---|---|---|
| G0 工具与基线 | 完成 | checkpoint/ui-mig-g0.7 | 设计参考 `design-ref/`、对比 `compare/`、动效曲线 `goal/g0.5/`、缓动测试 `veyra_qml_easing_tests`(构建目录 `build/qt-probe-20260926`)、门槛基线 `goal/g0.7/`(B 阶段性能对比用 `goal/g0.7/perf`) |
| G1 基础(缓动/背景/字体/图标/组件动效) | 完成 | checkpoint/ui-mig-g1.6 | G1.1–G1.6 完成(Qt 6.8.3:BezierSpline ≤10 段;CurveRenderer 不能用 fillItem;可变字体 600 须设 wght 轴;Popup 无 transform;视频子窗用 videoCover 挖区);动效探针 dock/page/switch/seg/menu/dialog;Quick Test 8/8;M28/M29 曲线未执行;下一步 G2 |
-| G2 外壳 | 进行中 | checkpoint/ui-mig-g2.2 | G2.1 dock 热区;G2.2 页面切换 sink(.22s)/150ms 后 rise(.6s spring-soft, d×45ms),motion 探针与设计稿同曲线;下一步 G2.3 视频几何同步 |
+| G2 外壳 | 进行中 | checkpoint/ui-mig-g2.3 | G2.1 dock 热区;G2.2 页面切换 sink/rise(探针同曲线);G2.3 视频窗随渲染帧同步(afterAnimating,去掉 16ms 计时器,矩形不变不调 SetWindowPos);下一步 G2.4 拖放/快捷键/电源/徽标/toast |
| G3 四主屏 | 未开始 | | |
| B1 小项 + 桥接补齐 | 未开始 | | |
| B2 导出补齐(S2.5) | 未开始 | | |
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index 5107a27f..e550be20 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -6655,3 +6655,9 @@ release. 5090 live acceptance, 15-second hitch and user flicker remain unresolve
- 探针 `motion.ps1 -Step g2.2 -Probes page`:QML 与设计稿均为峰值 16,34ms 起 16→0、约 175ms 到 0 并小幅回弹(chart-page.png;g0.5 基线 QML 恒 0)。首次跑出恒 0:shownPage 初值 "" 使首次切换走无动画分支,改初值 "home" 后修正。
- 实机点击(hover-shot.ps1 新增 click 步骤,visible-scene.mp4 从极简页点专业模式):t80 旧页仍在、t300/t1200 专业页就位;日志仅一次 `video host geometry 852x524` 与一次 `present-sink: resized`,无重新打开片源(switch/strip.png)。
- 未执行:原生视频窗随页面淡出(技术上不可淡,设计为切换完成后一次移动);逐帧 sink 曲线探针(仅测 rise)。
+- G2.3 视频窗口同步(`checkpoint/ui-mig-g2.3`,证据 `goal/g2.3/`):
+ - `apps/veyra-qml/main.cpp`:删除 16ms 常驻 QTimer,改为 `QQuickWindow::afterAnimating`(每个渲染帧前、GUI 线程)驱动;场景静止不出帧即零开销;另在事件循环开始后跑一次兜底首帧布局。videoHost 查找结果缓存(QPointer),查找日志只在查找时写,不再每 2 秒刷屏。
+ - `syncVideoGeometry` 缓存上次矩形,未变化且窗口可见时不调 SetWindowPos;挖区(SetWindowRgn)原本就有变化比较。
+ - 实测(visible-scene.mp4):极简页 → 点专业模式,日志仅 open 时 1280x720 与切页 852x524 各一次 `present-sink: resized`;静止画面正常(hover-idle.png);弹层(--menu source / preset)在画面上方仍正确挖区(hover-menusrc.png、hover-menu.png)。
+ - 日志中 `audio-track decoder rejected stream=1 code=-22` 与改动前(22:02 起)一致,属该素材第二音轨,非本次引入。
+ - 未执行:拖拽改窗口尺寸的逐帧跟随录屏;PresentMon 对比(放 G2.5/W3)。