Repository navigation
hls.js patch down to its export list: the HLS save reads samples from the moof; the subtitle guard and unread text tracks go - #612
Merged
Conversation
…from the moof; the subtitle guard and hls.js's unread text tracks go The patch made three changes; two go, the export list stays. outputSamples (2 hunks): the HLS save writes a plain MP4 and needs each sample's size, duration, composition offset and flags, so the patch added MP4Remuxer's sample list to its result. The same values are in the result already: the fragment's moof (data1), whose trun MP4Remuxer writes from that list. hls2mp4's samplesFromMoof reads them back. Before the hunks went, all 3,383 samples of the 38 saves in hls2mp4.test.mjs and saveDownloadsAhead.test.mjs (H.264, HEVC, AAC, MP3, AC-3, discontinuities, holes, a damaged packet) came out identical both ways, compared in pushChunk; a flag read from the wrong bit failed that comparison. The moof is always there: hls.js leaves it empty only for bare MPEG audio, and the transmuxer asks for MP3 in MP4 (typeSupported.mpeg false). Two unit tests: a hand-built moof with a negative video offset (fails when the offset is read unsigned), and the refusals. The #7460 subtitle part guard (1 hunk) was not FastStream's: it is video-dev/hls.js#7463 (2025-08), which upstream withdrew in #7626 (2026-01, in 1.7.0) when SubtitleStreamController learnt to load VTT parts. It never ran here: it sits in shouldLoadParts's config.lowLatencyMode branch, and HLSPlayer sets lowLatencyMode false. HLSPlayer: enableWebVTT, enableIMSC1, enableCEA708Captions and the three metadata-cue switches off. FastStream turns hls.js's subtitles off (subtitleTrack -1) and reads no video.textTracks; hls.js still decoded CEA-608 captions into hidden tracks (createNativeTrack, 'hidden') and made cues of ID3, emsg and EXT-X-DATERANGE metadata for every fragment. Nothing the user sees changes. The patch is 1 hunk, 11 lines (4 hunks, 40 lines before). Verified locally: lint, typecheck, 3378 unit tests, vendor sync. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FastStream's hls.js patch goes from 3 changes (4 hunks, 40 lines) to 1 (the export list, 11 lines). Nothing the user sees changes.
outputSamplesdropped. The HLS save needs each sample's size, duration, composition offset and flags. hls.js already returns them inside the fragment'smoof(data1): itstrunis written from exactly that list.samplesFromMoofinhls2mp4.mjsreads them back. Proof before removing the hunks: all 3,383 samples of the 38 save tests (H.264, HEVC, AAC, MP3, AC-3, discontinuities, holes, a damaged packet) came out identical both ways, and a flag read from the wrong bit failed that comparison. There are two new unit tests, one with a negative video offset (it fails when the offset is read unsigned). Themoofis always present: hls.js leaves it out only for bare MPEG audio, and FastStream's transmuxer asks for MP3 in MP4.lowLatencyMode: false.video.textTracks. Even so, hls.js decoded CEA-608 captions into hidden tracks and made cues of ID3, emsg and DATERANGE metadata for every fragment.enableWebVTT,enableIMSC1,enableCEA708Captionsand the three metadata-cue switches are now off.The remaining export list goes upstream as its own PR, after which the patch can go entirely.
Verified locally: lint, typecheck, 3378 unit tests, vendor sync. The HLS playback and save e2e specs run in CI.
🤖 Generated with Claude Code