Skip to content

fix(demux): repair missing composition offsets across a seek onto an open GOP (#699) - #707

Merged
superuser404notfound merged 1 commit into
mainfrom
fix/699-repair-before-first-seek
Oct 7, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
fix/699-repair-before-first-seek

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

Follow-up to #699 / 7.27.3, from the device report in #699 (software-path resume onto a CRA left in decode order).

1. Verdict before the first seek. Demuxer armed the #409 repair at the first read. SoftwarePlaybackHost seeks to its resume position before reading, so the sample began on the landing CRA (picture order != 0) and classify returned inconclusive. Every demuxer seek now goes through noteCompositionRepairSeekLocked(), which settles the verdict at the head first when nothing has been read yet. The held head sample is dropped by the existing noteSeek().

2. Leading pictures at the landing. The rewriter re-anchored a post-seek keyframe as if it were the first picture displayed. A CRA with leading pictures is displayed L slots after its decode slot, so the whole axis sat L slots early, and B pictures that then fell below their own decode time went out untouched (duplicate PTS). This affects every seek on such files, native path included. After a seek the session now holds packets (all streams, bounded by the existing ceilings) from the landing keyframe to the first trailing picture, counts L, and anchors with it.

Tests. CompositionOffsetRepairFirstSeekTests: libx265 open-GOP twin (CRA + 4 RASL at frame 30, setts=pts=DTS for the broken twin). Resume-shaped seek and mid-playback seek both match the healthy twin packet for packet. Without part 1 the resume test fails; without part 2 both fail. Full swift test green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS

…open GOP (#699)

Two defects behind the software host's resume reading decode order on HEVC
MP4s without ctts (reported on #699 after 7.27.3):

- The repair verdict was reached at the first read. The software host seeks
  to its resume position before that read, so the sample started on the
  landing CRA, whose picture order is not 0, and the classifier refused. A
  seek before the first read now settles the verdict at the head first.

- After any seek the rewriter anchored the landing keyframe as the first
  picture displayed. An open GOP's CRA is displayed after the leading
  pictures decoded behind it, so the axis sat one slot early per leading
  picture and B pictures fell below their decode time and went out
  untouched. The session now holds from the landing to the first trailing
  picture, counts the leading pictures, and anchors with that count.

Twin fixture with a CRA and four RASL pictures at frame 30; each half fails
the new tests without the other.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS
@superuser404notfound
superuser404notfound merged commit 84f4462 into main Oct 7, 2026
4 checks passed
@superuser404notfound
superuser404notfound deleted the fix/699-repair-before-first-seek branch October 13, 2026 06:38
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