Skip to content

fix: seek no longer returns a NaN offset on fragmented files - #583

Merged
DenizUgur merged 1 commit into
gpac:mainfrom
zzoraemon043:fix/fragmented-seek-offset
Nov 20, 2026
Merged

DenizUgur merged 1 commit into
gpac:mainfrom
zzoraemon043:fix/fragmented-seek-offset

Conversation

@zzoraemon043

Copy link
Copy Markdown
Contributor

Description

Fixes #520.

Samples built from moof/trun in updateSampleLists had no alreadyRead. seekTrack returns sample.offset + sample.alreadyRead, so on a fragmented track the offset was NaN. In seek() a NaN offset never wins the < comparison, so it fell back to { offset: nextParsePosition, time: 0 }: the caller is sent to the end of what has been parsed and the requested samples are never fetched. Non-fragmented samples already start with alreadyRead: 0; fragmented ones now do too.

Test: seeks to a sample offset in a fragmented file on isobmff/10_fragments.mp4. It fails before the change (expected NaN to be 11117).

npx vitest run: 56 passed. tests/conformance.test.ts reports "No test found" on my machine, same on main without this change. npm run types, npm run build, eslint and prettier pass. Changeset added.

Samples built from moof boxes had no alreadyRead, so seekTrack computed offset + undefined. Fixes gpac#520.
@changeset-bot

changeset-bot Bot commented Nov 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b9bba1d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mp4box Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@DenizUgur
DenizUgur added this pull request to the merge queue Nov 20, 2026
Merged via the queue into gpac:main with commit 0ae4c11 Nov 20, 2026
1 check passed
@github-actions github-actions Bot mentioned this pull request Nov 20, 2026
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.

Seeking fragmented file broken

2 participants