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(playback): acknowledge seek presentation and respect output slot leases
Veyra Goal Agentc8ea577e9f2a
diff --git a/apps/veyra/ui/AppShell.cpp b/apps/veyra/ui/AppShell.cppindex 832aabb0..7033e8bb 100644--- a/apps/veyra/ui/AppShell.cpp+++ b/apps/veyra/ui/AppShell.cpp@@ -340,7 +340,7 @@ case Capture:case ProRailCapture:veyra::ui::showCapturePanel(hwnd,[](const std::case Export:if(uiState.mode==veyra::ui::Mode::Professional)startVideoExport(false);break;case Info:showDiagnostics=!showDiagnostics;layout();break;}return 0;-case WM_HSCROLL:if(reinterpret_cast<HWND>(lp)==GetDlgItem(hwnd,Volume)){engine.setVolume(float(SendDlgItemMessageW(hwnd,Volume,TBM_GETPOS,0,0))/100,false);return 0;}if(reinterpret_cast<HWND>(lp)==seekBar){dragging=LOWORD(wp)==TB_THUMBTRACK;auto s=engine.snapshot();if(!dragging&&s.duration>0)engine.seek(s.duration*SendMessageW(seekBar,TBM_GETPOS,0,0)/10000.0);}return 0;+case WM_HSCROLL:if(reinterpret_cast<HWND>(lp)==GetDlgItem(hwnd,Volume)){engine.setVolume(float(SendDlgItemMessageW(hwnd,Volume,TBM_GETPOS,0,0))/100,false);return 0;}if(reinterpret_cast<HWND>(lp)==seekBar){dragging=LOWORD(wp)==TB_THUMBTRACK;auto s=engine.snapshot();if(!dragging&&LOWORD(wp)!=TB_ENDTRACK&&s.duration>0)engine.seek(s.duration*SendMessageW(seekBar,TBM_GETPOS,0,0)/10000.0);}return 0;case WM_KEYDOWN:if(wp==VK_ESCAPE&&protectionArmed){cancelProtection();return 0;}if(wp==VK_SPACE){SendMessageW(hwnd,WM_COMMAND,Play,0);return 0;}if(wp==VK_F11){toggleFullscreen();return 0;}if(wp==VK_ESCAPE&&full){toggleFullscreen();return 0;}if(wp=='V'&&uiState.mode==veyra::ui::Mode::Professional){holdOriginal=true;updateComparison();return 0;}break;case WM_KEYUP:if(wp=='V'){holdOriginal=false;updateComparison();return 0;}break;case WM_SYSKEYDOWN:if(wp==VK_RETURN&&(lp&(1LL<<29))){toggleFullscreen();return 0;}break;@@ -398,12 +398,12 @@ setText(GetDlgItem(hwnd,Mute),!s.audioAvailable?L"无音轨":s.muted?L"静音":LEnableWindow(seekBar,s.running&&!s.capture&&!s.image&&s.duration>0);ShowWindow(seekBar,(!full||fullControls)&&!s.capture&&!s.image&&!(showDiagnostics&&uiState.mode==veyra::ui::Mode::Professional&&!full)?SW_SHOW:SW_HIDE);EnableWindow(GetDlgItem(hwnd,Play),!currentFile.empty()&&!s.capture&&!s.image);EnableWindow(GetDlgItem(hwnd,Stop),s.running);setText(GetDlgItem(hwnd,MediaTitle),currentFile.empty()?L"尚未打开媒体":s.remotePlay?L"PS5 · LIVE":s.capture?L"采集卡 · LIVE":std::filesystem::path(currentFile).filename().wstring());auto stamp=[](double v){int seconds=std::max(0,int(v));return std::format(L"{:02}:{:02}:{:02}",seconds/3600,seconds/60%60,seconds%60);};-setText(GetDlgItem(hwnd,TimeLabel),s.remotePlay?(s.remoteRatesReady?std::format(L"接收 {:.1f} · 解码 {:.1f} fps",s.remoteReceivedFps,s.remoteDecodedFps):std::wstring(L"PS5 帧率采样中")):s.capture?std::format(L"输入 {:.1f} fps{}",s.captureFps,s.captureHalfRate?L" · 60→30":s.applied.content==veyra::engine::ContentRate::Capture60To30?L" · 不适用":L""):s.image?L"静态图片":stamp(s.position)+L" / "+stamp(s.duration)+(s.transport==veyra::engine::TransportState::Opening?L" · 正在打开…":s.failed?L" · 发生错误,详见专业诊断":L""));+setText(GetDlgItem(hwnd,TimeLabel),s.remotePlay?(s.remoteRatesReady?std::format(L"接收 {:.1f} · 解码 {:.1f} fps",s.remoteReceivedFps,s.remoteDecodedFps):std::wstring(L"PS5 帧率采样中")):s.capture?std::format(L"输入 {:.1f} fps{}",s.captureFps,s.captureHalfRate?L" · 60→30":s.applied.content==veyra::engine::ContentRate::Capture60To30?L" · 不适用":L""):s.image?L"静态图片":stamp(s.seekPresented<s.seekRequested&&!s.failed?s.seekTarget:s.position)+L" / "+stamp(s.duration)+(s.seekPresented<s.seekRequested&&!s.failed?L" · 跳转中…":L"")+(s.transport==veyra::engine::TransportState::Opening?L" · 正在打开…":s.failed?L" · 发生错误,详见专业诊断":L""));std::wstring metric=std::format(L"源帧处理 {:.1f} fps · 显示提交 {:.1f} fps · 有效生成 {}\n提交迟到 p95 {:.1f} ms · GPU / CPU 时间分别统计\n{}\n实际扫描率与光子延迟:未测",s.fps,submittedFps,s.generated,s.lateP95Ms,s.status);setText(metricLabel,metric);if(uiState.mode==Mode::Professional&&!full&&!transition.running&&GetTickCount64()-dashboardTick>=250){dashboardTick=GetTickCount64();RECT client{};GetClientRect(hwnd,&client);RECT dashboard{0,client.bottom-dip(hwnd,232),client.right,client.bottom};InvalidateRect(hwnd,&dashboard,FALSE);}exportJob.watching(preferWatching&&s.running&&s.transport==veyra::engine::TransportState::Playing);auto job=exportJob.poll();exportPanelStatus(job,!currentFile.empty()&&!s.capture&&!s.image&&s.frames>0&&!s.applying,s.running&&s.frames>0);setText(GetDlgItem(hwnd,JobProgress),job.message+std::format(L" {}% · 查看",int(job.progress*100)));ShowWindow(GetDlgItem(hwnd,JobProgress),job.state==veyra::engine::ExportState::Idle||full?SW_HIDE:SW_SHOW);setText(GetDlgItem(hwnd,EmptyTitle),s.failed?L"播放已停止":L"开始观看");setText(GetDlgItem(hwnd,EmptyHint),s.failed?s.status:L"打开本地视频,或连接采集卡\n精细调整与原生导出在专业模式中");ShowWindow(GetDlgItem(hwnd,EmptyTitle),SW_HIDE);ShowWindow(GetDlgItem(hwnd,EmptyHint),SW_HIDE);-if(!dragging&&s.duration>0){int position=int(s.position/s.duration*10000);if(SendMessageW(seekBar,TBM_GETPOS,0,0)!=position)SendMessageW(seekBar,TBM_SETPOS,TRUE,position);}+if(!dragging&&s.duration>0){int position=int((s.seekPresented<s.seekRequested&&!s.failed?s.seekTarget:s.position)/s.duration*10000);if(SendMessageW(seekBar,TBM_GETPOS,0,0)!=position)SendMessageW(seekBar,TBM_SETPOS,TRUE,position);}if(!smokeViewApplied&&!smokeView.empty()&&(s.frames>0||smokeEmpty)){smokeViewApplied=true;if(smokeView==L"small")SetWindowPos(hwnd,nullptr,0,0,800,600,SWP_NOMOVE|SWP_NOZORDER);if(smokeView!=L"daily"&&smokeView!=L"empty"&&uiState.mode==veyra::ui::Mode::Daily)switchMode();if(smokeView==L"export")selectInspector(3);if(smokeView==L"diagnostics"){showDiagnostics=true;layout();}if(smokeView==L"fullscreen")toggleFullscreen();}if(smokeDualPause&&pausedPosition<0&&s.frames>20){engine.pause(true);pausedPosition=s.position;pausedFrames=s.frames;}if(smokeDual&&startTick&&s.frames>10&&dualStep<40&&GetTickCount64()-startTick>ULONGLONG(1500+dualStep*200)){if(dualStep==4){modeGdiStart=GetGuiResources(GetCurrentProcess(),GR_GDIOBJECTS);GetProcessHandleCount(GetCurrentProcess(),&modeHandlesStart);PROCESS_MEMORY_COUNTERS_EX pm{};pm.cb=sizeof(pm);GetProcessMemoryInfo(GetCurrentProcess(),reinterpret_cast<PROCESS_MEMORY_COUNTERS*>(&pm),sizeof(pm));modePrivateStart=pm.PrivateUsage;}switchMode();diff --git a/docs/SEEK_PROGRESS_REPAIR_2026-09-12.md b/docs/SEEK_PROGRESS_REPAIR_2026-09-12.mdnew file mode 100644index 00000000..7147f952--- /dev/null+++ b/docs/SEEK_PROGRESS_REPAIR_2026-09-12.md@@ -0,0 +1,10 @@++## 2026-09-12 拖动进度条回弹及输出槽占用错误++用户日志03:09:30.998 frame-pool slot=1 still leased; refusing overwrite batch=1276。此前两次seek约344.93/643.709秒已完成,再播放时发生。原始日志保留logs/seek-user-original.log。证据证明资源仍被占用;不能仅凭这条日志确定唯一引用持有者。++Engine背压从只检查两个batch容量改为同时检查下一奇偶输出槽所有real/generated弱引用是否释放;推进呈现/完成观测后再取下一帧,不覆盖活跃纹理。跳转请求在背压等待中到达时立即返回外层处理seek,避免旧时间线继续取帧;无作业却长期占槽才超时报错,不把正常低帧率deadline等待当错误。未关闭原frame-pool保护,未增加每帧GPU fence阻塞。++进度条松手后原来立即用旧snapshot.position刷新,导致回弹。现在seek请求和呈现确认有序号,发出后保持最新目标,只有该请求对应的新帧实际Present后才恢复跟随;TB_ENDTRACK不重复发请求,时间文字显示目标及跳转中。暂停连续请求以最后一次为准。顺带修复有效生成帧从Pending到Valid时队列计数增加可能触发unsigned减法的问题。++验证:最终构建logs/seek-ui-final-build.log;repair_contract 88checks0failures。新增LivePresentationTests --seek-stress,实际用户4K长视频、原生NR+3X,六次前后seek(含原日志两位置)、每次后续45原帧、暂停连续32/44/61秒seek、恢复和关闭,16项通过exit0,logs/seek-stress-final.stdout.log与logs/seek-stress-final/engine.log,180秒上限内结束。此前首轮测试分支插入遗漏误入旧测试导致FAIL,logs/seek-stress.stdout.log保留;修正后seek-stress2及最终两轮均通过。UI既有切换脚本logs/seek-ui.log通过;未通过自动鼠标视频测试独立逐帧验证拖动视觉,需用户实测手感。未做新的PS5/采集卡测试、未发布或push。diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex ea6390a2..3574bcec 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -1708,3 +1708,13 @@ FrameFlowMetrics.pendingOutputFrames 接实际呈现作业中尚未消费的有用户指定只在曲线卡片区域切换。右上小三角切换精细数据/曲线;顶部四卡、底部队列与状态固定。精细列表按卡片高度裁切完整行,滚轮仅在卡片内容区生效;返回曲线保留历史。旧全局标题点击切换已取消。构建 logs/dashboard-inset-final-build.log 通过,UI脚本按DPI点击新位置、依次抓取overview/advanced/returned,logs/dashboard-inset-final-ui.log通过;实际查看advanced截图,顶部/底部固定且文字未溢出卡片。首次链接被运行中EXE占用,正常关闭后重建;测试脚本首轮坐标变量遗漏,补齐后重跑,上述最终结果为有效证据。未修改播放链路,不重复GPU性能测试;未发布。++## 2026-09-12 拖动进度条回弹及输出槽占用错误++用户日志03:09:30.998 frame-pool slot=1 still leased; refusing overwrite batch=1276。此前两次seek约344.93/643.709秒已完成,再播放时发生。原始日志保留logs/seek-user-original.log。证据证明资源仍被占用;不能仅凭这条日志确定唯一引用持有者。++Engine背压从只检查两个batch容量改为同时检查下一奇偶输出槽所有real/generated弱引用是否释放;推进呈现/完成观测后再取下一帧,不覆盖活跃纹理。跳转请求在背压等待中到达时立即返回外层处理seek,避免旧时间线继续取帧;无作业却长期占槽才超时报错,不把正常低帧率deadline等待当错误。未关闭原frame-pool保护,未增加每帧GPU fence阻塞。++进度条松手后原来立即用旧snapshot.position刷新,导致回弹。现在seek请求和呈现确认有序号,发出后保持最新目标,只有该请求对应的新帧实际Present后才恢复跟随;TB_ENDTRACK不重复发请求,时间文字显示目标及跳转中。暂停连续请求以最后一次为准。顺带修复有效生成帧从Pending到Valid时队列计数增加可能触发unsigned减法的问题。++验证:最终构建logs/seek-ui-final-build.log;repair_contract 88checks0failures。新增LivePresentationTests --seek-stress,实际用户4K长视频、原生NR+3X,六次前后seek(含原日志两位置)、每次后续45原帧、暂停连续32/44/61秒seek、恢复和关闭,16项通过exit0,logs/seek-stress-final.stdout.log与logs/seek-stress-final/engine.log,180秒上限内结束。此前首轮测试分支插入遗漏误入旧测试导致FAIL,logs/seek-stress.stdout.log保留;修正后seek-stress2及最终两轮均通过。UI既有切换脚本logs/seek-ui.log通过;未通过自动鼠标视频测试独立逐帧验证拖动视觉,需用户实测手感。未做新的PS5/采集卡测试、未发布或push。diff --git a/include/veyra/engine/EngineController.h b/include/veyra/engine/EngineController.hindex e746aec1..3b73d389 100644--- a/include/veyra/engine/EngineController.h+++ b/include/veyra/engine/EngineController.h@@ -35,6 +35,7 @@ struct PlayerSnapshot {bool audioRebuffering=false;uint64_t audioVideoWaits=0;bool audioEndpointRecovering=false;HRESULT audioEndpointError=S_OK;uint64_t audioEndpointRecoveries=0;+ uint64_t seekRequested=0,seekPresented=0;double seekTarget=0;double position=0,duration=0,fps=0,lateMs=0,lateP95Ms=0;double nominalSourceFps=0;diagnostics::FrameMetrics metrics;@@ -76,7 +77,7 @@ public:void previewView(PreviewView view){if(!std::isfinite(view.zoom)||!std::isfinite(view.centerX)||!std::isfinite(view.centerY))return;std::lock_guard lock(mutex_);view.zoom=std::clamp(view.zoom,.05f,64.0f);previewView_=view;}PreviewView previewView()const{std::lock_guard lock(mutex_);return previewView_;}void setVolume(float gain,bool mute);- void seek(double seconds){seekSeconds_.store(seconds);}+ void seek(double seconds){if(!std::isfinite(seconds)||seconds<0)return;std::lock_guard lock(mutex_);snapshot_.seekTarget=seconds;++snapshot_.seekRequested;seekSeconds_.store(seconds);}void saveFrame(const std::wstring& path);void startExport(const std::wstring& input,const std::wstring& output,PlayerOptions,bool hevc);PlayerSnapshot snapshot()const;diff --git a/include/veyra/pipeline/EnhanceGraph.h b/include/veyra/pipeline/EnhanceGraph.hindex 95046b8e..bbf8c12d 100644--- a/include/veyra/pipeline/EnhanceGraph.h+++ b/include/veyra/pipeline/EnhanceGraph.h@@ -132,6 +132,12 @@ public:// Returns false on hard failure (run verdict must FAIL).using FgAdmission=std::function<bool(const FrameBatch&)>;bool process(const AVFrame* frame, double ptsMs, bool reset, FrameOutputs& out, uint64_t sourceFrameId = 0, const ColorDescription* color = nullptr, bool retainReferences = true, const FgAdmission& admitFg = {});+ bool nextFrameSlotAvailable()const {+ const unsigned slot=unsigned(realFrameIndex_%2);+ if(!realLeases_[slot].expired())return false;+ for(unsigned i=slot;i<6;i+=2)if(!generatedLeases_[i].expired())return false;+ return true;+ }// Nonblocking. The scheduler polls at a GPU-ready/deadline boundary; no// full image readback and no waits inside the graph's individual passes.bool resolveGeneration(FrameOutputs& out);diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cppindex 8b14dc3d..3081cac4 100644--- a/src/engine/EngineController.cpp+++ b/src/engine/EngineController.cpp@@ -208,6 +208,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sstatus(isImage?L"图片已增强,可保存PNG/JPEG":std::format(L"{} | 输入 {}×{} / 底图 {}×{} / NR {}×{} / 光流 {}×{} / FG与输出 {}×{} | {}",isRemote?L"PS5 串流":isCapture?L"实时采集":L"播放",width,height,gd.workWidth,gd.workHeight,gd.nrWidth,gd.nrHeight,gd.flowWidth,gd.flowHeight,gd.workWidth,gd.workHeight,gd.nrWidth<gd.workWidth?L"实时内部处理并回填":L"原生NR(性能成本较高)"));pipeline::EnhanceGraph::FrameOutputs out;bool reset=true,hasOutput=false,audioRebuffering=false,seekPreviewPending=false;bool initialRemoteFramePending=isRemote;+ uint64_t activeSeekId=0;bool fileAwaitingVideo=true,fileAudioAlignPending=true,fileInputEnded=false;double lastFilePresentedMs=0,lastFilePresentLateness=0;std::deque<double> latenessSamples;if(!isImage&&!isCapture&&audioPipe.open(path)){audioPipe.holdForVideo();audioPipe.startThread(&audio,true);audioStarted=true;@@ -438,7 +439,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sstd::lock_guard lock(mutex_);desired_.rejectVideoRequest(requested,previous);snapshot_.desired=desired_;snapshot_.rejectedRevision=requested.revision;snapshot_.applying=desired_!=previous;snapshot_.status=L"设置应用失败,已恢复上一套参数";snapshot_.backendWarning=requested.nrRuntime!=previous.nrRuntime?L"NR运行版本切换失败,已恢复上一套参数":requested.frameGenerationBackend==FrameGenerationBackend::XeSS?L"XeSS 未能启用,已恢复上一套参数":L"后端切换失败,已恢复上一套参数";}}if(stop_)break;- const double seek=seekSeconds_.exchange(-1);+ double seek;{std::lock_guard lock(mutex_);seek=seekSeconds_.exchange(-1);if(seek>=0)activeSeekId=snapshot_.seekRequested;}if(seek>=0&&!isImage&&!isCapture){holdFileAudio();fileAudioAlignPending=true;drainLivePresentation();@@ -462,11 +463,14 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s// Backpressure before reading the capacity-one source mailbox:// when a lease frees we consume the newest available sample.if(liveScheduler&&!transaction){- while(liveScheduler->occupancy()>=2&&!stop_&&(!paused_||seekPreviewPending)&&!liveScheduler->failed()){- advanceLive();if(liveScheduler->occupancy()>=2)waitLive();+ const auto leaseWaitStart=Clock::now();+ while((liveScheduler->occupancy()>=2||!graph.nextFrameSlotAvailable())&&!stop_&&(!paused_||seekPreviewPending)&&!liveScheduler->failed()){+ advanceLive();if(seekSeconds_>=0)break;+ if(liveScheduler->occupancy()==0&&!graph.nextFrameSlotAvailable()&&elapsedMs(leaseWaitStart)>2000){status(L"等待输出纹理释放超时",true);stop_=true;break;}+ if(liveScheduler->occupancy()>=2||!graph.nextFrameSlotAvailable())waitLive();std::lock_guard lock(mutex_);if(desired_.revision!=options.settings.revision)break;}- if(stop_||(paused_&&!seekPreviewPending)||liveScheduler->failed()||liveScheduler->occupancy()>=2)continue;+ if(stop_||seekSeconds_>=0||(paused_&&!seekPreviewPending)||liveScheduler->failed()||liveScheduler->occupancy()>=2||!graph.nextFrameSlotAvailable())continue;}const auto decodeStart=Clock::now();if(injectSourceGap&&frames>=12){@@ -690,11 +694,11 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sconst double sourceIntervalMs=double(liveSourceInterval100ns(pkt.duration,activeSource->info().averageFps))/10000;const auto baselineReady=pkt.decodedHost100ns>0?pkt.decodedHost100ns:captureArrival;const bool delayEnhanced=options.nr||options.sr||options.fg;- if(!liveScheduler->push([&,watch,step,timeline,captureArrival,baselineReady,delayEnhanced,lineage,jobGeneration,rereadCached,sourceIntervalMs,flow=frameFlow](int64_t now)->LiveGpuScheduler::Step{+ if(!liveScheduler->push([&,watch,step,timeline,captureArrival,baselineReady,delayEnhanced,activeSeekId,lineage,jobGeneration,rereadCached,sourceIntervalMs,flow=frameFlow](int64_t now)->LiveGpuScheduler::Step{using State=LiveGpuScheduler::State;auto& batch=watch->output;auto& s=*step;auto updatePending=[&](LiveStepState*){unsigned left=0;for(unsigned i=s.next;i<batch.batch.count;++i)if(batch.batch.frames[i].kind!=pipeline::FrameKind::Generated||batch.batch.frames[i].validity==pipeline::GenerationValidity::Valid)++left;- flow->update([&](auto& m){m.pendingOutputFrames-=std::min(m.pendingOutputFrames,s.remaining-left);});s.remaining=left;+ flow->update([&](auto& m){if(left>s.remaining)m.pendingOutputFrames+=left-s.remaining;else m.pendingOutputFrames-=std::min(m.pendingOutputFrames,s.remaining-left);});s.remaining=left;};std::unique_ptr<LiveStepState,decltype(updatePending)> pendingUpdate(&s,updatePending);if(!watch->ready){if(elapsedMs(s.readyStart)>2000){veyra::log::error("capture-present","GPU ready timeout");return {State::Failed};}@@ -735,7 +739,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sif(xessPresented)flow->xessSubmitted(xessPresented,xessGenerated,host100ns());if(didPresent&&!isCapture){lastFilePresentedMs=itemPtsMs;lastFilePresentLateness=fileAwaitingVideo?0:nowMs()-itemPtsMs;- {std::lock_guard lock(mutex_);if(snapshot_.sessionId==runSessionId&&snapshot_.applied.revision==item.identity.settingsRevision){snapshot_.position=itemPtsMs/1000;snapshot_.lateMs=lastFilePresentLateness;}}+ {std::lock_guard lock(mutex_);if(snapshot_.sessionId==runSessionId&&snapshot_.applied.revision==item.identity.settingsRevision){snapshot_.position=itemPtsMs/1000;snapshot_.lateMs=lastFilePresentLateness;snapshot_.seekPresented=activeSeekId;}}double nextPts=itemPtsMs+sourceIntervalMs;for(unsigned next=s.next+1;next<batch.batch.count;++next){const auto& candidate=batch.batch.frames[next];if(candidate.kind!=pipeline::FrameKind::Generated||(candidate.validity==pipeline::GenerationValidity::Valid&&comparisonMode_==0)){nextPts=double(candidate.pts100ns)/10000;break;}}if(audioStarted){audioPipe.videoPresented(nextPts);audioPipe.setPaused(paused_);}diff --git a/tests/integration/LivePresentationTests.cpp b/tests/integration/LivePresentationTests.cppindex 93d33799..160f6588 100644--- a/tests/integration/LivePresentationTests.cpp+++ b/tests/integration/LivePresentationTests.cpp@@ -11,10 +11,12 @@ using namespace veyra;using namespace std::chrono_literals;int wmain(int argc,wchar_t**argv){SetEnvironmentVariableW(L"VEYRA_VERBOSE_FRAME_LOGS",L"1");- if(argc!=3&&!(argc==4&&(wcscmp(argv[3],L"--half-rate")==0||wcscmp(argv[3],L"--overload")==0||wcscmp(argv[3],L"--overload-baseline")==0||wcscmp(argv[3],L"--file-overload")==0||wcscmp(argv[3],L"--source-gap")==0||wcscmp(argv[3],L"--file-endpoint")==0||wcscmp(argv[3],L"--file-continuity")==0||wcscmp(argv[3],L"--file-fg-recovery")==0||wcscmp(argv[3],L"--reset-rollback")==0)))return 2;SetProcessDPIAware();CoInitializeEx(nullptr,COINIT_MULTITHREADED);+ if(argc!=3&&!(argc==4&&(wcscmp(argv[3],L"--seek-stress")==0||wcscmp(argv[3],L"--half-rate")==0||wcscmp(argv[3],L"--overload")==0||wcscmp(argv[3],L"--overload-baseline")==0||wcscmp(argv[3],L"--file-overload")==0||wcscmp(argv[3],L"--source-gap")==0||wcscmp(argv[3],L"--file-endpoint")==0||wcscmp(argv[3],L"--file-continuity")==0||wcscmp(argv[3],L"--file-fg-recovery")==0||wcscmp(argv[3],L"--reset-rollback")==0)))return 2;SetProcessDPIAware();CoInitializeEx(nullptr,COINIT_MULTITHREADED);std::filesystem::create_directories(argv[2]);Logger::instance().openFile((std::filesystem::path(argv[2])/"engine.log").wstring());Logger::instance().setConsoleEnabled(false);HWND window=CreateWindowExW(0,L"STATIC",L"Live scheduler replay",WS_POPUP,0,0,960,540,nullptr,nullptr,GetModuleHandleW(nullptr),nullptr);if(!window)return 3;engine::EngineController engine;engine::PlayerOptions options;options.nr=false;options.fg=false;options.captureReplayForTest=true;+ const bool seekStress=argc==4&&wcscmp(argv[3],L"--seek-stress")==0;+ if(seekStress){options.captureReplayForTest=false;options.nr=options.fg=true;options.realtime=false;options.fgMultiplier=3;engine.setVolume(0,true);}const bool halfRate=argc==4&&wcscmp(argv[3],L"--half-rate")==0;const bool sourceGap=argc==4&&wcscmp(argv[3],L"--source-gap")==0;if(sourceGap){SetEnvironmentVariableW(L"VEYRA_TEST_REPLAY_SOURCE_GAP",L"1");options.nr=options.fg=true;options.fgMultiplier=2;}@@ -32,6 +34,20 @@ int wmain(int argc,wchar_t**argv){int failures=0;auto check=[&](bool pass,const char* s){std::cout<<(pass?"PASS ":"FAIL ")<<s<<std::endl;if(!pass)++failures;};auto until=[&](auto predicate,int seconds=8){auto deadline=std::chrono::steady_clock::now()+std::chrono::seconds(seconds);while(std::chrono::steady_clock::now()<deadline){MSG msg;while(PeekMessageW(&msg,nullptr,0,0,PM_REMOVE)){TranslateMessage(&msg);DispatchMessageW(&msg);}auto s=engine.snapshot();if(s.failed){std::wcerr<<s.status<<'\n';return false;}if(predicate(s))return true;std::this_thread::sleep_for(5ms);}return false;};engine.open(window,argv[1],options);+ if(seekStress){+ check(until([](const auto& s){return s.position>1&&s.frames>15;},20),"initial native NR/FG playback");+ for(double target:{344.93,643.709,12.0,450.0,28.0,700.0}){+ engine.seek(target);const auto requested=engine.snapshot().seekRequested;+ check(until([&](const auto& s){return s.seekPresented==requested&&s.position>=target-.1;},12),"seek acknowledged by new presented frame");+ const auto base=engine.snapshot().metrics.flow.counters.realPresented;+ check(until([&](const auto& s){return s.metrics.flow.counters.realPresented>=base+45;},8),"continued playback releases output leases");+ }+ engine.pause(true);std::this_thread::sleep_for(100ms);engine.seek(32);engine.seek(44);engine.seek(61);+ const auto requested=engine.snapshot().seekRequested;+ check(until([&](const auto& s){return s.seekPresented==requested&&s.position>=60.9;},12),"paused rapid seeks keep latest request");+ engine.pause(false);check(until([](const auto& s){return s.position>62;},8),"resume after paused seek");+ engine.stop();check(until([&](const auto&){return engine.idle();},5),"seek session closes");DestroyWindow(window);CoUninitialize();return failures?1:0;+ }if(fileRecovery){check(until([](const auto& s){return s.metrics.flow.generatedPresentFps>15&&s.metrics.flow.presentSubmitFps>45;},15),"NR plus 2X starts with real generated presentation");const auto before=engine.snapshot();const auto wallStart=std::chrono::steady_clock::now();