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: drain a bounded PCM fade before controlled audio reanchors

Veyra Goal Agent98c9f5b656a2
diff --git a/docs/CONTINUATION_REPAIR_IMPLEMENTATION_2026-09-10.md b/docs/CONTINUATION_REPAIR_IMPLEMENTATION_2026-09-10.md
index de9f32f5..b7df8bee 100644
--- a/docs/CONTINUATION_REPAIR_IMPLEMENTATION_2026-09-10.md
+++ b/docs/CONTINUATION_REPAIR_IMPLEMENTATION_2026-09-10.md
@@ -4,6 +4,22 @@
## 2026-09-11 续接实证(优先于下面历史进度)
+### 最新续接:可控音频重锚淡出
+
+基线 `78675f2` 干净。可控采集设置/PTS突变、大幅A/V重锚和文件播放中seek在Reset前提交240帧(48k、5ms)立体声淡出,优先使用旧PCM,不足时由最后已提交样本收尾;旧队列已经空或之前补静音时不复活陈旧样本。读取实际WASAPI padding确认尾段消耗后重置,再沿用既有淡入。不是只改音量变量,也没有改用户音量或源PTS。
+
+正常pump未增加等待。淡出仅在重锚边界、音频owner上执行,80ms超时/停止取消/端点错误均退出;暂停、不在播放或已失效端点直接Reset。淡出期间clock为未知,不能把人工收尾样本计为有效媒体进度。日志分清提交、端点消耗、超时和取消;端点padding清空不是扬声器发声测量。物理设备突然消失、已发生的欠载断音无法事后淡出。
+
+构建 `scripts/build.ps1 -Root <root> -Preset x64-release`,`logs/continuation-repair-20260910/audio-fade-final-build.log` exit0。短测通过 `scripts/acceptance/scheduler-short-test.ps1 -Name <名称> -Exe out/build/x64-release/<test>.exe -TestArgs <result.args>`:
+
+- `continuation-audio-fade-final-timeline` 55项2.652秒PASS:PCM两声道单调到零、真实WASAPI尾段消耗/重置、暂停不Start、取消立即返回、播放中seek到600ms及前序设备恢复/媒体映射。EXE `354FDD6C4D94F5B95D625819E3839B0E2E2004B78F575A6A31C443EE06485CD6`。
+- `continuation-audio-fade-final-player` 7项2.348秒PASS,真实引擎端点恢复/共同时间线/暂停seek,EXE `9B6B24751D2A40521409D03D35BDBFC81F3D0C4E588FDE36250C57923166727B`。素材同前序 `test_av_1080p.mp4`、SHA `7952AD2904C8FED78402BC299EA2A04D1D869663EBCE17BBAC0C297F84FA2A91`。
+- `continuation-audio-fade-final-capture` 11.105秒PASS,合成采集PCM+真实WASAPI:自动80/160、手动/关闭/负偏移、断流/重开、500ms突发队列。偏差约10.6至21.3ms;淡出实际边界等待约16至40ms(包括旧端点排队),不是正常每帧增加此延迟。EXE `3924491A3819367B1859D4DF30458C19FC31171C02C20D72D5CD3D071B220AFD`。无物理采集、无外部听觉验证。
+
+最终联合 `scripts/gates/delivery.ps1 -Root <root>` 23项PASS,`logs/delivery/6304c4518f864f34a4bb91392cd16ab1/result.json`;当前应用SHA `A86DB75E321677C2B9EDC0380D3BC4DCC13FAD3DE5BA05D59DA5C1C30C6BB97A`,worker仍 `EC8150FF88C7C84FACDF92B920DED2D6CEC5F682990C375A92550AFD5E818695`。实际RTX NR/NVOF/NVENC等原合同执行,未加重导出检查,未修改SDK/runtime或发布。所有单测少于300秒。
+
+下一条唯一任务:补全原方案reset/重建耗时。当前`FrameFlowMetrics`有阶段计时但没有reset排空/销毁/创建/预热到首有效输出的测量;`DiagnosticHistory`仅64条去重错误,不能当8192逐帧性能轨迹。需先按实际时间边界建立当前事务证据,区分轻量reset和资源重建、请求与实际applied、回滚与恢复,不能把图process整段叫NR reset耗时。AMD provider/权重/预览环境、系统高DPI与实卡仍未完成,整体目标active。
+
### 最新续接:文件音频端点恢复与共同时间线
基线 `bba7283` 工作树干净,上一轮UI修复/AMD loader定因属于有效进展。本轮完成文件WASAPI端点错误后的自动恢复,不改SR -> NR -> FG、导出检查或实体采集设置。
diff --git a/docs/HANDOFF_2026-09-10.md b/docs/HANDOFF_2026-09-10.md
index 805decf1..2816a64b 100644
--- a/docs/HANDOFF_2026-09-10.md
+++ b/docs/HANDOFF_2026-09-10.md
@@ -4,6 +4,10 @@
## 2026-09-11 当前可续接状态
+最新:`78675f2`之后可控音频重锚已加入真实5ms PCM淡出和端点消耗后Reset,最长80ms仅边界等待,正常pump不加等待。55项音频、7项真实player、合成采集通过;最终delivery `6304c4518f864f34a4bb91392cd16ab1`23项PASS,应用SHA `A86DB75E321677C2B9EDC0380D3BC4DCC13FAD3DE5BA05D59DA5C1C30C6BB97A`。物理拔插已经发生的断音不能事后淡出,未外部听觉/实卡验收。完整命令/证据在[实施记录](CONTINUATION_REPAIR_IMPLEMENTATION_2026-09-10.md)。
+
+下一条唯一任务转reset/重建计时:`FrameFlowMetrics`仍缺排空/销毁/创建/预热到首有效输出;`DiagnosticHistory`64条去重错误不是逐帧8192性能轨迹。按原方案补真实边界与回滚/取消证据,不把process总耗时冒充reset。AMD完整网络/provider、真实系统150%/200%DPI和实卡未完成,目标active、不发布。下方“下一步淡出”是历史快照。
+
**当前优先读本段及实施记录最上方,后面的“下一条文件音频恢复”已完成软件闭环。** 基线`bba7283`后实现文件WASAPI owner线程重建、500ms重试、共享clock生命周期保护、断开时共同媒体时钟保持、最后有效PTS重锚、断开期间seek和暂停恢复。最终47项音频/7项真实player通过,原生4K过载/合成采集回归通过;delivery `5c80d299087b4f2482706bf2a24df9c9`23项42.420秒PASS,当前EXE `E2EA9CB93CB290E6B13683647835B3E7F54EA21810FC358D69DB803AA9168866`。具体命令、失败与身份见[实施记录](CONTINUATION_REPAIR_IMPLEMENTATION_2026-09-10.md)。未改系统默认设备、未实卡/AMD、未发布。
下一条唯一任务:可控音频重锚的短淡出与边界(现有淡入已保留,突然拔掉硬件本身无法淡出),随后逐项审计原方案计时/reset覆盖。当前自动重连针对已打开端点失效,默认设备切换但旧端点仍可用时未主动迁移。AMD provider/权重/预览环境仍缺,150%/200%只是应用注入、真实系统高DPI与实卡未测。全目标保持active。
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index 8c7c89ea..23d8b5f0 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -1,5 +1,7 @@
# 2026-09-11 继续修复目标模式执行中
+最新可控淡出:基线`78675f2`,为采集设置/PTS/大偏差重锚和文件播放中seek加入真实240帧PCM淡出,WASAPI padding消耗后Reset再淡入;边界最长80ms,取消/错误退出,正常pump不加等待。55项timeline、7项真实player、11.105秒合成采集通过;重锚额外等待约16至40ms,普通偏差10.6至21.3ms。最终delivery `6304c4518f864f34a4bb91392cd16ab1`23项PASS,应用SHA `A86DB75E321677C2B9EDC0380D3BC4DCC13FAD3DE5BA05D59DA5C1C30C6BB97A`;命令、测试身份与边界见实施记录最新段。真实RTX执行,未实卡/外部听觉验收,无发布。下一任务补reset排空/销毁/创建/预热恢复计时及逐帧轨迹;AMD完整网络/provider仍缺,目标active。
+
最新文件音频恢复:基线`bba7283`。修复pump失败退出音频线程和clock失效后视频转墙钟继续播放;文件端点改由音频owner创建/500ms重连/释放,clock读取与COM生命周期互斥,最后有效PTS重锚、断开期间seek更新目标、暂停预填不Start,状态区显示恢复/HRESULT/次数。最终音频47项2.628秒、真实player7项2.297秒PASS;原生4K过载5项及合成采集回归通过。首轮任意并发读取次数门槛失败已保留并改成验证实际并发生命周期,详见实施记录最上方。最终build `audio-file-recovery-final-build.log`exit0,delivery `5c80d299087b4f2482706bf2a24df9c9`23项42.420秒PASS,应用SHA `E2EA9CB93CB290E6B13683647835B3E7F54EA21810FC358D69DB803AA9168866`。RTX NR/NVOF/NVENC已实跑,未实卡/AMD/真实系统设备拔插。下一任务可控音频重锚短淡出与原方案剩余计时覆盖审计;AMD依赖/provider、高DPI实机和实卡未完成。整体目标active,本地存档,不发布。
最新AMD诊断(UI已经提交`ee46c5f`):隔离探针调试输出明确`Preview releases of D3D12Core require Developer Mode.`,随后CLSID_D3D12CoreModule获取失败;已解释先前0x887E0003,尚未到GPU能力查询。`continuation-amd-debug-loader`0.088秒exit1,完整stdout/result在`logs/scheduler-repair-20260910/`,只调试自有进程。未开开发者模式、未改主程序runtime、未提取权重。AMD完整网络/provider仍未实现。下一条独立任务转文件音频端点失败恢复,避免共享renderer shutdown与引擎clock读取竞态;详见实施记录最新段。整体目标active,不发布。
diff --git a/include/veyra/sink/AudioGain.h b/include/veyra/sink/AudioGain.h
index 51af400e..25ceafb7 100644
--- a/include/veyra/sink/AudioGain.h
+++ b/include/veyra/sink/AudioGain.h
@@ -8,4 +8,11 @@ inline void applyStereoGain(float* samples,size_t frames,float target,float& cur
target=std::isfinite(target)?std::clamp(target,0.0f,1.0f):0;
for(size_t i=0;i<frames;++i){current+=std::clamp(target-current,-1.0f/240,1.0f/240);samples[i*2]*=current;samples[i*2+1]*=current;}
}
+// Full transition duration is fixed even when the current user gain is low.
+inline void fadeStereoTail(float* samples,size_t frames,float gain){
+ if(!frames)return;
+ gain=std::isfinite(gain)?std::clamp(gain,0.0f,1.0f):0;
+ for(size_t i=0;i<frames;++i){const float envelope=frames>1?gain*float(frames-1-i)/float(frames-1):0;
+ samples[2*i]*=envelope;samples[2*i+1]*=envelope;}
+}
}
diff --git a/include/veyra/sink/WasapiAudioSink.h b/include/veyra/sink/WasapiAudioSink.h
index 046221cd..cac1f195 100644
--- a/include/veyra/sink/WasapiAudioSink.h
+++ b/include/veyra/sink/WasapiAudioSink.h
@@ -38,6 +38,7 @@ constexpr double kAudioHighWatermarkMs = 1000.0;
constexpr uint32_t kAudioRate = 48000;
class AudioRenderer; // forward: pipeline thread needs the renderer
+enum class AudioFadeResult { NotPlaying, Drained, Cancelled, TimedOut, Failed };
class AudioPipeline : public AudioPcmSource {
public:
@@ -156,6 +157,8 @@ public:
// Atomic seek support: stop + reset the endpoint; the clock is invalid
// until the next startAnchored.
void stopAndReset();
+ // Audio-owner only; drains a 5ms fade before a controlled reset, bounded to 80ms.
+ AudioFadeResult fadeAndReset(AudioPcmSource& source,const std::atomic<bool>& cancel);
bool started() const;
uint64_t underruns() const;
@@ -190,6 +193,8 @@ private:
std::atomic<double> anchorPtsMs_{0.0};
std::atomic<bool> started_{false};
std::atomic<bool> running_{false};
+ std::atomic<bool> fading_{false};bool pausedEndpoint_=false;
+ float lastRawLeft_=0,lastRawRight_=0;
bool comInited_ = false;
std::atomic<uint64_t> underruns_{0};
std::atomic<uint64_t> framesWritten_{0};
diff --git a/src/sink/CaptureAudioSession.cpp b/src/sink/CaptureAudioSession.cpp
index c1017836..5647dc60 100644
--- a/src/sink/CaptureAudioSession.cpp
+++ b/src/sink/CaptureAudioSession.cpp
@@ -111,7 +111,7 @@ struct CaptureAudioSession::Impl : AudioPcmSource {
}
if(mode!=appliedMode||offset!=appliedOffset){reset=true;appliedMode=mode;appliedOffset=offset;}
if(reset||chunk.discontinuity){
- renderer.stopAndReset();clearPcm();swr_close(swr);
+ renderer.fadeAndReset(*this,stop);clearPcm();swr_close(swr);
if(swr_init(swr)<0){fail(L"音频重采样重置失败");break;}
if(!clearCorrection()){fail(L"音频漂移校正重置失败");break;}
std::lock_guard lock(mutex);++state.resets;
@@ -129,7 +129,7 @@ struct CaptureAudioSession::Impl : AudioPcmSource {
const double end=chunk.pts+1000.0*(inputFrames-swr_get_delay(swr,format.nSamplesPerSec))/format.nSamplesPerSec;
if(reset||chunk.discontinuity)log::info("capture-audio-reset",std::format("mode={} pts={} delayBefore={} delayAfter={} input={} output={}",appliedMode,chunk.pts,delay,swr_get_delay(swr,format.nSamplesPerSec),inputFrames,count));
if(haveHead&&std::abs(start-pcmTimeline.at(double(pcmTail)).value_or(start))>50){
- renderer.stopAndReset();clearPcm();
+ renderer.fadeAndReset(*this,stop);clearPcm();
std::lock_guard lock(mutex);++state.resets;
}
{
@@ -195,7 +195,7 @@ struct CaptureAudioSession::Impl : AudioPcmSource {
const double error=audioPts-(double(observed)/10000-mapping);
filteredError=.75*filteredError+.25*error;nextCorrection=observed+2500000;
if(observed-lastReset>10000000&&std::abs(error)>60){
- renderer.stopAndReset();lastReset=observed;filteredError=correctionPpm=0;
+ renderer.fadeAndReset(*this,stop);lastReset=hostTime();filteredError=correctionPpm=0;
std::lock_guard lock(mutex);++state.resets;
}else{
const double targetPpm=std::clamp(filteredError*250.0,-5000.0,5000.0);
diff --git a/src/sink/WasapiAudioSink.cpp b/src/sink/WasapiAudioSink.cpp
index ef4572b1..63428198 100644
--- a/src/sink/WasapiAudioSink.cpp
+++ b/src/sink/WasapiAudioSink.cpp
@@ -2,6 +2,7 @@
#include "veyra/sink/WasapiAudioSink.h"
#include <algorithm>
+#include <array>
#include <cmath>
#include <cstring>
#include <format>
@@ -319,6 +320,7 @@ bool AudioRenderer::startAnchored(AudioPcmSource& pipeline, bool paused)
anchorPos_ = pos;
anchorPtsMs_.store(firstBufferPtsMs);
if (!paused && !checked(client_->Start(),"Start")) return false;
+ pausedEndpoint_=paused;
started_ = true;
veyra::log::info("audio", std::format("renderer ANCHORED ptsMs={:.1f} devicePos={} freq={} paused={}",
firstBufferPtsMs, pos, clockFrequency_,paused));
@@ -360,6 +362,7 @@ bool AudioRenderer::pumpOnce(AudioPcmSource& pipeline, double* firstWrittenPtsMs
if (!started_ && !got) return checked(render_->ReleaseBuffer(0, 0),"Release empty prefill");
const UINT32 written=started_&&pipeline.padUnderruns()?avail:static_cast<UINT32>(got);
if (got > 0) {
+ lastRawLeft_=chunk_[(got-1)*2];lastRawRight_=chunk_[(got-1)*2+1];
const float target=std::clamp(gain_.load(),0.0f,1.0f);
applyStereoGain(chunk_.data(),got,target,smoothedGain_);
if(target!=loggedGain_&&std::abs(smoothedGain_-target)<.00001f){loggedGain_=target;log::info("audio-gain",std::format("target={} reached={} framesWritten={} clockPreserved=true applicationPCM=true",target,smoothedGain_,framesWritten_.load()));}
@@ -373,6 +376,7 @@ bool AudioRenderer::pumpOnce(AudioPcmSource& pipeline, double* firstWrittenPtsMs
underruns_.fetch_add(1);
}
if (!checked(render_->ReleaseBuffer(written, 0),"ReleaseBuffer")) return false;
+ if(written>got)lastRawLeft_=lastRawRight_=0;
{
std::lock_guard lock(timelineMutex_);
if(got&&endPts){timedPcm_=true;outputTimeline_.append(timelineWriteFrame_,got,firstPts,*endPts);}
@@ -387,7 +391,7 @@ bool AudioRenderer::pumpOnce(AudioPcmSource& pipeline, double* firstWrittenPtsMs
double AudioRenderer::mediaTimeMs() const
{
std::lock_guard endpointLock(endpointMutex_);
- if (!running_ || !started_) return std::numeric_limits<double>::quiet_NaN();
+ if (!running_ || !started_ || fading_) return std::numeric_limits<double>::quiet_NaN();
UINT64 pos = 0, qpc = 0;
if (!checked(clock_->GetPosition(&pos, &qpc),"Clock GetPosition") || clockFrequency_ == 0) {
return std::numeric_limits<double>::quiet_NaN();
@@ -411,6 +415,41 @@ void AudioRenderer::stopAndReset()
timelineWriteFrame_=0;
bufferedMs_=0;smoothedGain_=0;
{std::lock_guard lock(timelineMutex_);outputTimeline_.clear();timedPcm_=false;}
+ fading_=false;pausedEndpoint_=false;lastRawLeft_=lastRawRight_=0;
+}
+
+AudioFadeResult AudioRenderer::fadeAndReset(AudioPcmSource& source,const std::atomic<bool>& cancel)
+{
+ if(!running_||!started_||pausedEndpoint_||FAILED(lastError_)){
+ stopAndReset();return AudioFadeResult::NotPlaying;
+ }
+ fading_=true;
+ const auto begin=std::chrono::steady_clock::now();
+ constexpr UINT32 frames=kAudioRate/200;
+ std::array<float,frames*2> tail{};
+ bool submitted=false;AudioFadeResult result=AudioFadeResult::TimedOut;
+ while(std::chrono::steady_clock::now()-begin<std::chrono::milliseconds(80)){
+ if(cancel){result=AudioFadeResult::Cancelled;break;}
+ UINT32 padding=0;
+ if(!checked(client_->GetCurrentPadding(&padding),"Fade GetCurrentPadding")){result=AudioFadeResult::Failed;break;}
+ if(padding>bufferFrames_){checked(E_UNEXPECTED,"Fade invalid padding");result=AudioFadeResult::Failed;break;}
+ if(submitted&&!padding){result=AudioFadeResult::Drained;break;}
+ if(!submitted&&bufferFrames_-padding>=frames){
+ BYTE* dest=nullptr;
+ if(!checked(render_->GetBuffer(frames,&dest),"Fade GetBuffer")){result=AudioFadeResult::Failed;break;}
+ double pts=-1;const size_t got=source.pull(tail.data(),frames,&pts);
+ const float left=got?tail[(got-1)*2]:(padding?lastRawLeft_:0),right=got?tail[(got-1)*2+1]:(padding?lastRawRight_:0);
+ for(size_t i=got;i<frames;++i){tail[i*2]=left;tail[i*2+1]=right;}
+ fadeStereoTail(tail.data(),frames,smoothedGain_);
+ std::memcpy(dest,tail.data(),sizeof(tail));
+ if(!checked(render_->ReleaseBuffer(frames,0),"Fade ReleaseBuffer")){result=AudioFadeResult::Failed;break;}
+ submitted=true;framesWritten_+=frames;
+ log::info("audio-fade",std::format("submitted frames={} realPcm={} finalLeft={} finalRight={}",frames,got,tail[frames*2-2],tail[frames*2-1]));
+ }
+ std::this_thread::sleep_for(std::chrono::milliseconds(1));
+ }
+ log::info("audio-fade",std::format("result={} submitted={} durationMs={:.3f} endpoint-consumption-not-speaker-measurement",int(result),submitted,std::chrono::duration<double,std::milli>(std::chrono::steady_clock::now()-begin).count()));
+ stopAndReset();return result;
}
bool AudioRenderer::started() const { return started_; }
@@ -427,6 +466,7 @@ void AudioRenderer::shutdown()
if (event_ != nullptr) { CloseHandle(event_); event_ = nullptr; }
running_ = false;
started_ = false;
+ fading_=false;pausedEndpoint_=false;
bufferedMs_=0;framesWritten_=0;clockFrequency_=0;
timelineWriteFrame_=0;
{std::lock_guard lock(timelineMutex_);outputTimeline_.clear();timedPcm_=false;}
@@ -437,7 +477,7 @@ void AudioRenderer::setPaused(bool value)
{
std::lock_guard endpointLock(endpointMutex_);
if (!client_ || !started_) return;
- checked(value ? client_->Stop() : client_->Start(),"Pause/resume");
+ if(checked(value ? client_->Stop() : client_->Start(),"Pause/resume"))pausedEndpoint_=value;
}
void AudioPipeline::runOnAudioThread(AudioRenderer* renderer, bool ownEndpoint)
@@ -519,7 +559,7 @@ void AudioPipeline::runOnAudioThread(AudioRenderer* renderer, bool ownEndpoint)
const double target = seekTargetMs_;
seekCount_.fetch_add(1);
lock.unlock();
- if (endpointReady) renderer->stopAndReset();
+ if (endpointReady) renderer->fadeAndReset(*this,stopFlag_);
lastClockMs=recoveryTargetMs=target;
const bool seekOk=rewind(target);
double startPts = seekOk?headPtsMs():std::numeric_limits<double>::quiet_NaN();
diff --git a/tests/integration/AudioTimelineTests.cpp b/tests/integration/AudioTimelineTests.cpp
index c30931cb..18a5501a 100644
--- a/tests/integration/AudioTimelineTests.cpp
+++ b/tests/integration/AudioTimelineTests.cpp
@@ -1,9 +1,11 @@
#include "veyra/sink/WasapiAudioSink.h"
+#include "veyra/sink/AudioGain.h"
#include <filesystem>
#include <fstream>
#include <iostream>
#include <cmath>
#include <functional>
+#include <array>
using namespace veyra::sink;
using namespace std::chrono_literals;
@@ -97,6 +99,19 @@ int wmain(int argc, wchar_t** argv) {
while(std::chrono::steady_clock::now()-recovery<100ms){double pts=0;if(!renderer.pumpOnce(live,&pts))break;}
const double recovered=renderer.mediaTimeMs();
check(std::isfinite(recovered)&&recovered>=500&&recovered<=live.pts,"recovered live clock references new PCM after device silence");
+ std::array<float,480> fadeSamples;fadeSamples.fill(1);
+ fadeStereoTail(fadeSamples.data(),240,.25f);
+ bool monotonic=true;for(size_t i=1;i<240;++i)monotonic&=fadeSamples[i*2]<=fadeSamples[(i-1)*2]&&fadeSamples[i*2]==fadeSamples[i*2+1];
+ check(fadeSamples.front()==.25f&&fadeSamples.back()==0&&monotonic,"five millisecond PCM fade reaches zero monotonically on both channels");
+ std::atomic<bool> cancelFade=false;
+ const auto faded=renderer.fadeAndReset(live,cancelFade);
+ check(faded==AudioFadeResult::Drained,"real WASAPI consumes submitted fade before reset");
+ check(!renderer.started()&&!std::isfinite(renderer.mediaTimeMs()),"fade reset invalidates old media clock");
+ check(renderer.startAnchored(live,true),"prefill paused endpoint after fade");
+ check(renderer.fadeAndReset(live,cancelFade)==AudioFadeResult::NotPlaying,"already paused endpoint resets without starting a fade");
+ check(renderer.startAnchored(live),"resume fresh PCM after controlled reset");
+ cancelFade=true;const auto cancelBegin=std::chrono::steady_clock::now();
+ check(renderer.fadeAndReset(live,cancelFade)==AudioFadeResult::Cancelled&&std::chrono::steady_clock::now()-cancelBegin<50ms,"cancellation does not wait for fade deadline");
renderer.shutdown();
const auto longFile=dir/"recovery.wav";fixture(longFile,48000,4000);
AudioPipeline recoveryPipe;AudioRenderer recoveryRenderer;recoveryRenderer.setGain(0);
@@ -115,6 +130,8 @@ int wmain(int argc, wchar_t** argv) {
const double restored=recoveryRenderer.mediaTimeMs();
std::cout<<"recovery before="<<beforeLoss<<" restored="<<restored<<'\n';
check(restored>=beforeLoss-30&&restored<=beforeLoss+50,"recovery replays from last clock, not decoded-ahead head");
+ const double liveSeek=recoveryPipe.requestSeek(600);
+ check(std::abs(liveSeek-600)<.05&&until([&]{return recoveryRenderer.mediaTimeMs()>=600;}),"playing file seek drains fade and anchors requested PCM");
recoveryPipe.setPaused(true);std::this_thread::sleep_for(70ms);
recoveryPipe.requestEndpointLossForTest();
check(until([&]{return recoveryPipe.endpointRecovering();}),"paused endpoint loss is detected");