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): keep capture-card window source title readable

Veyra Goal Agentcd3e829d4a37
diff --git a/apps/veyra/ui/AppShell.cpp b/apps/veyra/ui/AppShell.cpp
index b3127b36..c72bc0c9 100644
--- a/apps/veyra/ui/AppShell.cpp
+++ b/apps/veyra/ui/AppShell.cpp
@@ -16,6 +16,7 @@
#endif
#include "SubtitleOverlay.h"
#include "ProtectionOverlay.h"
+#include "SourceTitle.h"
#include "veyra/engine/ExportJobManager.h"
#include <future>
#include <psapi.h>
@@ -143,7 +144,7 @@ std::wstring fileDialog(bool save){std::vector<wchar_t> name(32768);OPENFILENAME
ofn.lpstrFilter=save?L"PNG图片\0*.png\0JPEG图片\0*.jpg\0":L"视频 / 图片\0*.mp4;*.mkv;*.mov;*.avi;*.ts;*.png;*.jpg;*.jpeg\0所有文件\0*.*\0";
ofn.Flags=OFN_EXPLORER|OFN_NOCHANGEDIR|OFN_PATHMUSTEXIST|(save?OFN_OVERWRITEPROMPT:OFN_FILEMUSTEXIST);ofn.lpstrDefExt=save?L"png":nullptr;
return (save?GetSaveFileNameW(&ofn):GetOpenFileNameW(&ofn))?name.data():L"";}
-void openFile(const std::wstring& file){if(file.empty())return;cancelProtection();auto openOptions=options();if(file!=currentFile){openOptions.settings.protection={};uiState.configured.protection={};}auto ext=std::filesystem::path(file).extension().wstring();for(auto& c:ext)c=towlower(c);if((ext==L".png"||ext==L".jpg"||ext==L".jpeg")&&uiState.mode==veyra::ui::Mode::Daily)switchMode();engine.previewView({});currentFile=file;subtitles=veyra::engine::loadSrt(std::filesystem::path(file).replace_extension(L".srt").wstring());paused=false;SetWindowTextW(GetDlgItem(mainWindow,Play),L"暂停");engine.open(video,file,openOptions);SetWindowTextW(mainWindow,(L"Veyra — "+std::filesystem::path(file).filename().wstring()).c_str());if(smokeSeconds<=0)WritePrivateProfileStringW(L"Player",L"最近打开",file.c_str(),(veyra::runtime::localDataDirectory()/"veyra.ini").wstring().c_str());}
+void openFile(const std::wstring& file){if(file.empty())return;cancelProtection();auto openOptions=options();if(file!=currentFile){openOptions.settings.protection={};uiState.configured.protection={};}auto ext=std::filesystem::path(file).extension().wstring();for(auto& c:ext)c=towlower(c);if((ext==L".png"||ext==L".jpg"||ext==L".jpeg")&&uiState.mode==veyra::ui::Mode::Daily)switchMode();engine.previewView({});currentFile=file;subtitles=veyra::engine::loadSrt(std::filesystem::path(file).replace_extension(L".srt").wstring());paused=false;SetWindowTextW(GetDlgItem(mainWindow,Play),L"暂停");engine.open(video,file,openOptions);SetWindowTextW(mainWindow,veyra::ui::windowTitleForSource(file).c_str());if(smokeSeconds<=0)WritePrivateProfileStringW(L"Player",L"最近打开",file.c_str(),(veyra::runtime::localDataDirectory()/"veyra.ini").wstring().c_str());}
HWND control(const wchar_t* cls,const wchar_t* label,int id,DWORD style,int x,int y,int w,int h){auto hwnd=CreateWindowExW(0,cls,label,WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|style|(_wcsicmp(cls,L"STATIC")?WS_TABSTOP:0),x,y,w,h,mainWindow,reinterpret_cast<HMENU>(INT_PTR(id)),GetModuleHandleW(nullptr),nullptr);SendMessageW(hwnd,WM_SETFONT,reinterpret_cast<WPARAM>(font),TRUE);veyra::ui::themeControl(hwnd);if(id>=Open&&id<=Fullscreen&&id!=Seek)toolbar.push_back({hwnd,w});return hwnd;}
void refreshDailyPresets(){auto h=GetDlgItem(mainWindow,DailyPreset);if(!h)return;SendMessageW(h,CB_RESETCONTENT,0,0);SendMessageW(h,CB_ADDSTRING,0,LPARAM(L"当前自定义设置"));for(auto& name:veyra::ui::presetNames())SendMessageW(h,CB_ADDSTRING,0,LPARAM(name.c_str()));SendMessageW(h,CB_SETCURSEL,0,0);}
void selectInspector(int page){uiState.inspector=page;veyra::ui::settingsPage(page);for(int i=0;i<4;++i)veyra::ui::selected(GetDlgItem(mainWindow,TabEnhance+i),i==page);veyra::ui::selected(GetDlgItem(mainWindow,TabAudio),page==4);}
diff --git a/apps/veyra/ui/SourceTitle.h b/apps/veyra/ui/SourceTitle.h
new file mode 100644
index 00000000..3906d984
--- /dev/null
+++ b/apps/veyra/ui/SourceTitle.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#include <filesystem>
+#include <string>
+
+namespace veyra::ui {
+
+// Physical capture sources are opened through opaque connection strings
+// ("capture:<index>..." and "capture2:<hex device path>:..."). They are not
+// file names. Using them as the window title leaked a multi-hundred character
+// hex blob to every window list (windows list of third-party broadcast tools,
+// taskbar, Alt+Tab), which made the live window impossible to recognise and
+// matched the reported "cannot find Veyra while it is capturing" symptom.
+inline bool isCaptureCardSource(const std::wstring& source) {
+ return source.starts_with(L"capture:") || source.starts_with(L"capture2:");
+}
+
+inline bool isRemotePlaySource(const std::wstring& source) {
+ return source.starts_with(L"remoteplay:");
+}
+
+inline std::wstring windowTitleForSource(const std::wstring& source) {
+ if (source.empty()) return L"Veyra — 本地实验版";
+ if (isCaptureCardSource(source)) return L"Veyra — 采集卡 · LIVE";
+ if (isRemotePlaySource(source)) return L"Veyra — PS5 Remote Play";
+ return L"Veyra — " + std::filesystem::path(source).filename().wstring();
+}
+
+} // namespace veyra::ui
diff --git a/docs/CAPTURE_WINDOW_TITLE_FIX_2026-09-15.md b/docs/CAPTURE_WINDOW_TITLE_FIX_2026-09-15.md
new file mode 100644
index 00000000..eff8a0fc
--- /dev/null
+++ b/docs/CAPTURE_WINDOW_TITLE_FIX_2026-09-15.md
@@ -0,0 +1,87 @@
+# 采集卡直播窗口标题修复(第三方窗口捕获“识别不到 Veyra”)
+
+## 结论
+
+采集卡来源(`capture:` / `capture2:` 连接串)被当成文件名写进了主窗口标题,导致 Veyra 在采集卡运行时标题变成一个 776 字符的十六进制设备路径串。任务栏、Alt+Tab 和第三方直播工具的窗口列表都只能看到这串机器码(直播伴侣自己还把标题截断到 259 字符再使用),用户在主窗口列表里无法辨认 Veyra,从而“还没抓就先开采集卡就抓不到”,而“先抓到窗口再开采集卡就一直正常”。
+
+本修复只改窗口标题与回归依据,不改采集、颜色、换链和呈现路径,也不改 `capture:`/`capture2:` 连接串格式。
+
+## 实测证据(本轮,用户实机)
+
+1. 采集卡运行中的 Veyra 主窗口标题(Windows 进程实测,`Get-Process ... MainWindowTitle`):
+
+```text
+Veyra — capture2:005C005C003F005C...005C0067006C006F00620061006C:0:0:0040006400650076006900630065003A0063006D003A...0077:0
+长度 776 字符(十六进制编码的视频设备路径 + 音频端点路径)
+```
+
+2. 同一进程在“没打开任何来源”时标题为 `Veyra — 本地实验版`(14 字符),播放文件时为 `Veyra — <文件名>`;只有采集卡来源会变成机器串。
+
+3. 直播伴侣自身的窗口捕获回调日志(`%APPDATA%\webcast_mate\biz-logs\2026-09-15-21-42-14.log`)在添加 Veyra 来源时记录到:
+
+```text
+[window capture] compatibleGameCallback {"windowClass":"VeyraApp","windowExe":"Veyra.exe",
+"windowTitle":"Veyra — capture2:005C005C003F...007B00360035006500380037003700330064002D00",
+"captureType":"WindowRTVisual2D","errorCode":"0x00000000"}
+```
+
+该字段只有 259 字符,末尾停在半个十六进制字符上,说明工具侧对标题做了固定长度截断后再参与来源命名/识别;其包内前端代码(`resources/app/app.content/resource/js/52682.*.js`)用 `window.EnumWindows` 结果生成来源名 `${exe} ${title}`,并按 `hwnd`/`pid` 回绑。
+
+4. 同一场会话的 `mediasdk_server` 日志显示:本轮“采集卡已在运行,再添加 game 来源”时,注入 hook 实际走通(`Load Shared Texture Success, size: 842 x 494, flip: 0`、`OnAutoSwitchMode from Window to Game`,之后 `GameSource` 每 10 秒 profile 连续 60 秒以上有数据)。因此“画面内容无法被捕获(全黑)”不是本轮的首要根因,标题不可辨认才是与现象一致的差异。
+
+## 代码根因与修复
+
+- 根因位置:`apps/veyra/ui/AppShell.cpp` 的 `openFile()` 无条件执行
+ `SetWindowTextW(mainWindow, (L"Veyra — " + std::filesystem::path(file).filename().wstring()).c_str())`。
+ 对采集卡来源 `file` 是连接串,`filename()` 返回整串连接串;PS5 串流有单独标题,所以只有采集卡中招。
+- 修复:新增纯函数 `apps/veyra/ui/SourceTitle.h::windowTitleForSource()`:
+ - `capture:` / `capture2:` → `Veyra — 采集卡 · LIVE`(与软件内 `MediaTitle` 文案一致)
+ - `remoteplay:` → `Veyra — PS5 Remote Play`
+ - 其它 → `Veyra — <文件名>`;空串 → `Veyra — 本地实验版`
+- `AppShell::openFile()` 改为调用该函数,其它行为(引擎打开、最近打开记录、字幕查找)不变。
+
+## 验证(实际执行)
+
+```powershell
+cmd.exe /c out\build\veyra-build-x64-release.cmd # exit 0,4/4:UiContractTests、AppShell、两次链接
+out\build\audio-continuity-repair-20260915\veyra_ui_contract_tests.exe <临时目录> # PASS,exit 0(新增标题合同断言)
+out\build\audio-continuity-repair-20260915\veyra.exe --smoke-seconds 6 capture:9:0:-1:0
+powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts\gates\delivery.ps1 -Root . -BuildDirectory out/build/audio-continuity-repair-20260915
+```
+
+- 新构建运行时标题实测:`Veyra — 采集卡 · LIVE`(18 字符)。
+- 对照组 1.3.0 便携版同一命令:`Veyra — capture:9:0:-1:0`(原始连接串直接进标题,确认修复前后差异)。
+- 采集卡实机(用户当前 1.3.0 会话)修复前:776 字符(见上)。
+- delivery 短测 23/23 PASS、59.633 秒,`logs/delivery/7283c292af9e471bbba9c4bc8b0316af/result.json`(`status=software_short_gate_passed`、`capture=awaiting_user_capture_test`);本构建 EXE SHA256 `0F1DEB29D80E80264CC5EE1D6D210D9415DEBC68EBA47DD22A1C73500D5700A4`。
+- 说明:smoke 退出码为 1,原因是伪造设备索引 `capture:9:...` 没有帧,smoke 判定条件要求 `frames>0`;本轮 smoke 只用于读取真实窗口标题,不作为采集/播放入证。
+
+### 真实采集卡运行复测(同机同设备,修复后)
+
+用本机实体采集卡(`\\?\usb#vid_345f&pid_2131&mi_00...` + `@device:cm:{33D9A762...}\wave:{73A0923C...}`,即用户会话同一连接串,重建为 `capture2:` 形式)跑修复后的候选 EXE:
+
+```powershell
+out\build\audio-continuity-repair-20260915\veyra.exe --smoke-seconds 12 <capture2:连接串>
+# t+4s / t+9s 实测 MainWindowTitle = Veyra — 采集卡 · LIVE(18 字符)
+# exit = 0
+```
+
+`logs/veyra-app.log` 对应片段:
+
+```text
+[capture] configured 1920x1080 nominalFps=60.000 upstreamSubtype=0x32595559 formatHr=0x0 ... audioDevice=0
+[present] present-sink: window 1280x712 swapEffect=flip-discard buffers=3 vsync=0 tearing=1 captureCompatible=false
+[capture] Run hr=0x0 actual=1920x1080 nominalFps=60.000
+[app] smoke frames=685 generated=0 failed=false ... capture=true processedFps=60.00 callbackFps=60.01 captureDropped=0
+```
+
+即:修复后采集卡真实出帧 685 帧 / 约 11.5 秒、0 丢弃、无失败,且整个过程窗口标题为可读短名。
+
+## 未验证与边界
+
+- 未直接驱动直播伴侣/OBS 的 UI 复测“先开采集再添加来源”是否出画;本机没有可用的第三方应用 UI 自动化,工具侧结论来自其自身日志与包内前端代码,属 Veyra 不可控一侧。
+- 不宣称第三方工具一定恢复正常:如果某个工具仍按标题长度或内容做额外限制,Veyra 无法覆盖;本修复消除的是 Veyra 自己制造的机器串标题。
+- 未推送、未发布;改动仅在工作区(`apps/veyra/ui/SourceTitle.h` 新增,`AppShell.cpp`、`tests/unit/UiContractTests.cpp` 修改),候选 EXE 位于 `out/build/audio-continuity-repair-20260915/`。
+
+## 下一步唯一任务
+
+用该候选构建,在同一采集卡场景下分别用直播伴侣的“窗口捕获”和“游戏捕获”各添加一次 Veyra,记录:列表里标题是否为 `Veyra — 采集卡 · LIVE`、是否出画、出画延迟量级。若窗口捕获仍无画面,下一步做 WGC 内容对照(同源三方对照),必要时再查换链/组合路径,而不是先调画质参数。
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index 028071d9..61fe066a 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -1,5 +1,11 @@
# 2026-09-11 继续修复目标模式执行中
+## 2026-09-15 采集卡直播窗口标题修复(第三方工具“识别不到 Veyra”)
+
+用户反馈除 OBS 外各平台直播工具无法识别“正在采集中的 Veyra”,且顺序敏感:先抓到窗口再开采集卡正常,先开采集卡再抓就抓不到。实机取证确认根因是 Veyra 自己:采集卡来源 `capture:`/`capture2:` 连接串被当文件名写进主窗口标题,实测标题长 776 字符(`Veyra — capture2:<十六进制设备路径>:...`),空闲/播放文件时为正常短名;直播伴侣日志把该标题截断到 259 字符后参与来源命名,其包内前端以 `${exe} ${title}` 命名来源。同场会话的 mediasdk_server 日志显示“采集卡已运行再添加 game 来源”的 hook 通路实际成功(`Load Shared Texture Success, size: 842 x 494`、`OnAutoSwitchMode from Window to Game`、GameSource 连续 60 秒以上有数据),因此本轮不做换链/画面的猜测性改动。
+
+修复新增 `apps/veyra/ui/SourceTitle.h`(`windowTitleForSource`),`AppShell::openFile` 对采集卡用 `Veyra — 采集卡 · LIVE`、PS5 用 `Veyra — PS5 Remote Play`、文件仍用文件名。构建 `cmd.exe /c out\build\veyra-build-x64-release.cmd` exit0(4/4);`veyra_ui_contract_tests.exe` PASS exit0(含新增标题合同);新 EXE `--smoke-seconds 6 capture:9:0:-1:0` 实测标题 `Veyra — 采集卡 · LIVE`(18 字符),1.3.0 便携版同命令为 `Veyra — capture:9:0:-1:0`;随后用本机实体采集卡连接串(`capture2:`,1920x1080 YUY2@60)跑 `--smoke-seconds 12`:exit0、`frames=685`、`captureDropped=0`、`failed=false`,t+4s/t+9s 标题保持 `Veyra — 采集卡 · LIVE`。delivery 23/23 PASS、59.633 秒,`logs/delivery/7283c292af9e471bbba9c4bc8b0316af/result.json`,EXE SHA256 `0F1DEB29D80E80264CC5EE1D6D210D9415DEBC68EBA47DD22A1C73500D5700A4`,gate 自身仍标 `capture=awaiting_user_capture_test`。未驱动第三方 UI 复测(本机无可用 UI 自动化)、未 push/发布,候选 EXE 在 `out/build/audio-continuity-repair-20260915/`。完整证据、边界与下一步见 [采集卡直播窗口标题修复](CAPTURE_WINDOW_TITLE_FIX_2026-09-15.md)。
+
## 2026-09-15 VRR / 自动音频补偿延迟排查
用户反馈疑似采集卡在PS5开启VRR后自动补偿导致声音延迟、关闭补偿恢复。当前没有反馈者版本/实卡日志,不能认定VRR根因。新增生产CaptureAudioSession诊断`--sync-clock-audit`:正常可变观察间隔下补偿35.50ms、PCM队列13.75ms;保持合成画面延迟35ms而视频PTS后移1200ms时,补偿1235.51ms、PCM队列1214.56ms;同时间戳关闭补偿后0ms/10ms。真实WASAPI、合成PCM且增益0,不是实卡或声学测量。专项exit1保留失败,证明现有自动同步缺少时间戳可比性验证;未修改产品同步策略。
diff --git a/tests/unit/UiContractTests.cpp b/tests/unit/UiContractTests.cpp
index 61ab1eea..315dae6e 100644
--- a/tests/unit/UiContractTests.cpp
+++ b/tests/unit/UiContractTests.cpp
@@ -4,6 +4,7 @@
#include "../../apps/veyra/ui/TransportLayout.h"
#include "../../apps/veyra/ui/UiPreferenceStore.h"
#include "../../apps/veyra/ui/CapturePreferenceStore.h"
+#include "../../apps/veyra/ui/SourceTitle.h"
#include "veyra/engine/EngineController.h"
#include "veyra/sink/AudioGain.h"
#include "veyra/engine/PreviewView.h"
@@ -44,6 +45,20 @@ int wmain(int argc,wchar_t** argv){try{
const auto restored=store.load();require(restored.videoPath==p.videoPath&&restored.formatKey==p.formatKey&&restored.audioPath==p.audioPath&&restored.audioMode==p.audioMode&&restored.colorOverride==p.colorOverride,"capture stable identifiers and Unicode round trip");
}
require(ResolutionPlan::make({1448,1086},true,NrSizePolicy::Native,true).output==Extent{2880,2160},"4:3 SR preserves aspect");
+ {
+ // A live capture card shares its window list entry with every external
+ // broadcast tool. The encoded connection string must never become the
+ // window title again (it made the live window unrecognisable).
+ const std::wstring encoded=L"capture2:005C005C003F005C0075007300620023007600690064005F003300340035006600:0:0:005C005C003F005C0061007500640069006F:0";
+ require(ui::isCaptureCardSource(encoded)&&ui::isCaptureCardSource(L"capture:0:1:-1:0"),"capture connection strings detected");
+ require(ui::windowTitleForSource(encoded)==L"Veyra — 采集卡 · LIVE","capture2 connection string never becomes the window title");
+ require(ui::windowTitleForSource(L"capture:0:1:-1:0")==L"Veyra — 采集卡 · LIVE","legacy capture connection string never becomes the window title");
+ require(ui::windowTitleForSource(L"remoteplay:")==L"Veyra — PS5 Remote Play","remote play keeps its readable title");
+ require(ui::windowTitleForSource(L"D:\\media\\clip.mp4")==L"Veyra — clip.mp4","file title keeps the file name");
+ require(ui::windowTitleForSource(L"")==L"Veyra — 本地实验版","empty source restores the default title");
+ for(const auto& title:{ui::windowTitleForSource(encoded),ui::windowTitleForSource(L"capture:0:1:-1:0")})
+ require(title.find(L"capture2:")==std::wstring::npos&&title.find(L"capture:")==std::wstring::npos&&title.find(L'\\')==std::wstring::npos&&title.size()<64,"exposed window title stays short and path free");
+ }
require(ResolutionPlan::make({1080,1920},true,NrSizePolicy::Native,true).output==Extent{1214,2160},"portrait SR even dimensions");
require(!ResolutionPlan::make({2880,2160},true,NrSizePolicy::Native,true).srApplied,"already maximum edge skips SR");
require(ResolutionPlan::make({1920,1080},true,NrSizePolicy::Realtime,false).output==Extent{3840,2160},"16:9 SR unchanged");