Skip to content

A seek drops the packets the repair verdict left held (#409 follow-up) - #415

Merged
superuser404notfound merged 1 commit into
mainfrom
fix/409-held-packets-survive-seek
Aug 24, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
fix/409-held-packets-survive-seek

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

Fixes a regression 261d310a put on main: Issue259A53CaptionAxisTests fails on main (f08db21d) and passes on 7ba42377, the commit before the #409 merge.

The defect

The composition-offset repair settles its verdict by reading ahead and HOLDING what it read, so the container's own order survives the decision. noteSeek() dropped that queue only in the .sampling phase:

case .sampling: /* held packets freed */
case .repairing: rewriter?.noteSeek(); reader?.reset()
case .off:       break        // the queue stays

A settled verdict leaves the sample it read in the queue (a healthy file decides .off while still holding it), and dequeue() hands that queue out ahead of anything read after a seek. So the abandoned position's packets are re-served at the landing.

Measured on a healthy MP4 with B-frames: after decideCompositionOffsetRepair() plus seek(to: 1.0), the reader delivers

[0, 1536, 512, 1024, 3584, 2560, 2048, 3072, 5632, 4608, 4096, 5120,   <- the held sample, again
 0, 1536, 512, 1024, 3584, 2560, 2048, 3072, 5632, 4608, 4096, 5120]   <- the landing

against a reference arm that never sampled. Every consumer of the demuxer sees it: the fMP4 producer, the segment plan, the software decoder, the still extractor.

Why #409's verification did not catch it

It compared the repaired arm against its healthy twin, packet for packet. Both arms carry the same held queue, so both were wrong in the same way and the comparison stayed green. The A/53 axis test is the one that compares against the container instead, and it went red.

Tests

Two pins, both fixture-gated like the rest of the repair suite: the landing after a seek must match a reference demuxer that never sampled (fails without the fix, with the twelve-packet repeat above), and deciding the verdict without a seek must still cost no packet (guards the opposite mutation, dropping the queue unconditionally).

Suite 2028/2028 green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RbWZLwBVLGM1xUVXa9NeJ1

The composition-offset repair settles its verdict by reading ahead and HOLDING
what it read, so the container's own order survives the decision. `noteSeek()`
dropped that queue only while the sample was still open. A verdict that has
already landed leaves its sample in the queue, and `dequeue()` hands the queue
out ahead of anything read after the seek, so the abandoned position's packets
are re-served at the landing.

Measured on a healthy MP4 with B-frames (verdict `.off`, sample still held):
after `decideCompositionOffsetRepair()` plus a seek, the reader delivered the
first twelve packets a second time before the landing's own. Every consumer of
the demuxer sees it, and `Issue259A53CaptionAxisTests` has been failing on main
since 261d310 with exactly that shape, two duplicate A/53 observations mid
stream (green on 7ba4237, the commit before the merge).

The queue is dropped in every phase now; the phase-specific state resets keep
their own branches. #409's own verification could not see this: it compared the
repaired arm against its healthy twin, and both arms carry the same held queue,
so both were wrong in the same way.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01RbWZLwBVLGM1xUVXa9NeJ1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant