Validate integrated FFmpeg runtime hardening stack - #150
Blackspirits wants to merge 1 commit into
Conversation
Blackspirits
left a comment
There was a problem hiding this comment.
Final adversarial integration review on 70a0619926a7bd9666c45469e70cfcd918ea4d4d after CI SubtitleEdit#294: no blocker found. Verified load-generation and seek-serial publication fences compose, stale CloseFile cleanup cannot erase a replacement load, startup/teardown and deferred reclamation remain ordered, UI final dispose is exactly-once/off-thread, seek flush and lastDropped ownership are closed, hardware replay rejects pre-replay packets, recoverable demux errors do not truncate input, software decoder-open fallback remains one-shot, and the complete #149 audio/clock-health stack remains intact. Evidence-only PR; no merge/promotion performed.
21a37e7 to
ee6ca3a
Compare
11161a9 to
3e2971c
Compare
Blackspirits
left a comment
There was a problem hiding this comment.
Final adversarial integration review on 3e2971cbbdb1376d2029f2ee37878c66bb326ce9 after CI SubtitleEdit#308: no blocker found. Rechecked all twelve runtime invariants after rebuilding on corrected #149. The new post-reset baseline latch and two-consecutive-query health policy remain intact in WinMM/Core Audio, while load-generation fencing, lifecycle reclamation, transactional seek, hardware replay serials, frame ownership/publication, demux retry, decoder-open fallback, serial-fenced PCM, wall-clock failover and decode-only unknown-duration EOF behavior remain unchanged. No merge/promotion performed.
Purpose
Integration-only validation of the current FFmpeg runtime hardening stack.
The base is #149, which already contains the integrated audio core, WinMM hardening, runtime wall-clock failover, decode-only continuation after sink failure, and explicit native clock-health handling.
This integration commit layers the remaining audited runtime/lifetime/video behavior from:
lastDroppedownership cleanup;This PR is audit evidence only and is not a merge candidate.
Current upstream
SubtitleEdit/subtitleeditmain was rechecked atdda1fce8f9d4a605b1b6732acc072c7109dc6323; the current upstream delta is Auto-Translate work and does not touch this FFmpeg runtime.Why this integration matters
By this point the individual fixes are well tested, but runtime correctness depends on the composition of three independent generations/ownership domains:
The integrated tree must preserve ordering across all three while also keeping UI teardown non-blocking and retaining fail-closed native resources when a worker refuses to stop.
Composition invariants
A stale Session cannot publish into a newer load.
Decoder name and presented frame publication are load-generation fenced.
A stale CloseFile cannot erase a newer load.
Owner frame/decoder cleanup is accepted only for the current load generation.
Startup and teardown are serialized.
Session.Start and Dispose share the lifecycle lock; partial Thread.Start failure tears down every worker that did start.
Timed-out teardown remains fail closed but reclaimable.
Worker-visible format/sink/events remain alive; the last late worker schedules one-shot cleanup instead of converting a temporary timeout into a permanent leak.
UI final teardown is non-blocking and exactly-once.
FFmpeg defers final CloseFile to background Dispose, the render host relinquishes ownership before detach, and repeated CloseAndDisposePlayer cannot schedule a second Dispose.
Seek serial is the video publication fence.
A frame can only be claimed/published while holding the same seek lock that commits current serial.
Seek flush cannot recycle an object still held by the presenter.
Flushed queued VideoFrames are disposed rather than immediately returned to the pool.
Detached seek-frame ownership closes on all video-loop exits.
lastDroppedis returned from finally.Hardware fallback never feeds pre-replay compressed packets into the fresh software decoder.
Equal/newer replay serials are accepted; older packets are freed.
Recoverable demux errors do not create false EOF.
Only AVERROR_EOF / ended AVIO state publish end-of-input.
Hardware decoder-open failure is recoverable once.
If hardware was actually attached and avcodec_open2 fails, the failed context is freed and software open is attempted once.
The entire Fail over when FFmpeg audio clock queries fail #149 audio stack remains intact.
Structural gate before CI
The integrated HEAD was checked for regressions and confirmed:
TryGetPlayedSecondsstill present;_audioSink.Reset();PerformSeekstill present;_owner.Present(...);_owner._decoderName;lastDroppedfinally cleanup present;Scope / branch state
ee6ca3a2a1aebdd4f2be7871cc3b61bb1cdcab393e2971cbbdb1376d2029f2ee37878c66bb326ce9dda1fce8f9d4a605b1b6732acc072c7109dc6323Acceptance
AI assistance: ChatGPT was used for cross-stack runtime/lifetime/video reconciliation, generation/serial ownership review, regression-gate inspection, and integration acceptance design.
Final CI
Authoritative run: SubtitleEdit#308 on
3e2971cbbdb1376d2029f2ee37878c66bb326ce9Final adversarial integration review was performed on this exact HEAD after CI; all twelve runtime composition invariants remain satisfied.
This run supersedes the earlier #150 HEAD
70a0619926a7bd9666c45469e70cfcd918ea4d4d/ CI SubtitleEdit#294. The branch was rebuilt after #149 hardened post-reset clock baselines and transient native-query handling; the runtime integration preserves those corrected sink blobs and the added health-policy regressions.