Repository navigation
Conversation
|
Thanks for this, and especially for the twin fixtures. One encode muxed twice with the composition offsets removed from one is exactly the asset this needed, and I have kept that pair as the regression test for the fix. The diagnosis holds. I reproduced it on the Apple decoder rather than only in libavcodec, by decoding both twins through
What I could not keep is the remedy. Measured on the same pair,
It also trades hardware decode away for what is a container metadata defect. The information the container dropped is still in the bitstream, so #413 rebuilds it instead of routing around it. libavcodec's H.264 parser reads each access unit's picture order count without decoding a pixel, and it accepts MP4's length-prefixed AVCC payload directly, so the repair costs one slice header parse per video packet and no Annex-B conversion. The packet is then rewritten to what the muxer should have written: presentation by display rank, decode pulled back by the reorder delay, which is also what keeps Two things from this patch went straight into that one: the fail-closed shape of the detection (leave on the first real PTS/DTS offset, refuse anything unproven), and the fixtures. The bounded rewind handling here is careful work and would have been the right shape had the axis been usable, so closing this in favour of #413 is about the remedy only, not the report or the analysis behind it. |
|
Superseded by #413, which repairs the same defect at the demuxer boundary and keeps the native path. The fixtures from this PR are the regression test there, and the reasoning is in the comment above. |
… an MP4 dropped with its ctts table Repairs progressive H.264 MP4 whose writer omitted the composition-offset table while the bitstream still reorders pictures. Picture order comes from libavcodec's H.264 parser without decoding a pixel, and the packet is rewritten at the demuxer boundary to the timeline a correct muxer would have written, so the source keeps the native path and hardware decode. Supersedes #411; reported in #409, whose retest is still open.
Summary
Recover seekable progressive H.264 MP4 VOD whose sample table omitted composition offsets despite B-frame reordering. A bounded, fail-closed engine probe confirms the malformed timestamp signature, routes only that session through software decode, and schedules frames on libavcodec's monotonic
best_effort_timestamppresentation axis.Fixes #409
What changed
PTS != DTSpair and requires sufficient equal-timestamp, non-key, decoded-frame, raw-PTS-regression, and monotonic best-effort evidence before selecting repair.avcodec_receive_frameso captions, deinterlacing, seek filtering, and rendering share one repaired clock.AV_NOPTS_VALUEfallback and preserve the confirmed route/policy across audio switches and seekable-custom-source background reloads; reset it for every new public load.This is adjacent to #407 but covers a different failure: here every raw PTS is present, so the #407 NOPTS fallback correctly does nothing; the present raw axis itself regresses.
Test plan
PTS == DTS, while decoded raw PTS regressed 16 times and best-effort PTS advanced 58 times with zero regressions.ctts, while the malformed twin was stream-copied withsetts=pts=DTSand has no composition offsets.swift build— passed.swift test— 2,001 tests in 287 suites passed.swift build --build-tests --package-path Probes/TransportProbe— passed.xcodebuild build -scheme AetherEngine -destination 'generic/platform=tvOS Simulator' ...— passed.build-for-testing— passed.Checklist
CHANGELOG.mdupdatedfeat(...),fix(...),chore(...))