mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-18 06:13:42 +00:00
fix(hls): enforce supported HLS subset with explicit errors
The merge pipeline concatenates stored bytes, so features it cannot reproduce faithfully are now detected and rejected with a clear error instead of silently succeeding with a broken output: - EXT-X-GAP (a hole in the merged file) and EXT-X-DISCONTINUITY (a broken timeline) - separate audio renditions referenced by the selected variant: the master EXT-X-MEDIA groups are parsed and an AUDIO group with its own URI fails the resolve; unreferenced groups are ignored - changing init sections: a repeated EXT-X-MAP is compared by all of its attributes (URI and BYTERANGE), not just the URI - encrypted EXT-X-MAP without an explicit IV: the spec does not define a sequence-derived IV for init sections - non-identity AES-128 KEYFORMAT values The supported matrix is documented in the package doc. Add regression tests for every rejection plus real media validation: ffmpeg-generated TS segments and fMP4 init/fragments are committed as fixtures, downloaded through the fetcher (including an AES-128 key rotation variant), and the merged outputs are validated structurally - TS on the 188 byte grid with continuity counter rules, PAT/PMT and PES presence, fMP4 by walking the ISO-BMFF box hierarchy.
This commit is contained in:
1 parent
675028c64a
commit
f1f17948c6
12 files changed
+611
-32
No files matched your search
@@ -0,0 +1,24 @@
|
||||
// Package hls implements native HTTP Live Streaming downloads for m3u8
|
||||
// playlists. A task produces exactly one merged, playable output file:
|
||||
// MPEG-2 TS segments are concatenated as-is, fMP4 streams are merged as
|
||||
// init section followed by the media fragments, and AES-128 encrypted
|
||||
// segments are decrypted before they are stored.
|
||||
//
|
||||
// Supported subset:
|
||||
// - VOD media playlists (EXT-X-ENDLIST present) and master playlists whose
|
||||
// selected variant carries its own audio
|
||||
// - AES-128 with the identity KEYFORMAT, explicit IV or media-sequence
|
||||
// derived IV, including key rotation mid-playlist
|
||||
// - EXT-X-BYTERANGE (including offset inheritance) and fMP4 init sections
|
||||
// via a single, constant EXT-X-MAP
|
||||
//
|
||||
// Everything the merge pipeline cannot reproduce faithfully is rejected with
|
||||
// an explicit error instead of silently producing a broken output file:
|
||||
// - live streams (no EXT-X-ENDLIST) and SAMPLE-AES / DRM encryption
|
||||
// - EXT-X-GAP (would leave a hole) and EXT-X-DISCONTINUITY (broken timeline)
|
||||
// - changing init sections (a repeated EXT-X-MAP is compared by all its
|
||||
// attributes, not just the URI) and encrypted EXT-X-MAP without an
|
||||
// explicit IV
|
||||
// - separate audio renditions referenced by the selected variant (the
|
||||
// merged output would have no audio) and non-identity KEYFORMATs
|
||||
package hls
|
||||
Reference in new issue
Block a user