Commit Graph

5000 Commits

Author SHA1 Message Date
Shaka Bot 04a720fe40 chore(v5.1.x): release 5.1.6 (#10123) 2026-05-25 12:37:57 +02:00
absidue 21f7ad8e36 perf(transmuxer): Write nalu lengths directly into combined buffer in h265 (#10119) 2026-05-25 09:54:51 +02:00
Álvaro Velad Galván 6dcf8ba463 fix: Map the "audio/x-mpegurl" MIME type as HLS (#10114) 2026-05-25 09:54:51 +02:00
Shaka Bot d5cd3072ad chore(v5.1.x): release 5.1.5 (#10105) 2026-05-18 12:56:36 +02:00
Ivan 13b9ba1cab perf(Mp4Generator): assemble segment data in a single allocation (#10101)
This PR reduces allocation pressure in MP4 segment generation by writing
mdat data directly into the final segment buffer - this avoids one full
media-payload copy per segment
2026-05-18 11:00:27 +02:00
Álvaro Velad Galván d90d2217a6 fix(HLS): Fix timeline sync gaps on discontinuity sequences (#10087)
Calculates and compensates for PDT drift only when the discontinuity
sequence changes, preventing timeline breaks during manifest updates.

Fixes https://github.com/shaka-project/shaka-player/issues/10084
2026-05-18 10:46:42 +02:00
absidue 29533bdfee perf(transmuxer): Avoid repeatedly creating empty Uint8Arrays (#10100)
In `H264.getVideoSamples()` `lastVideoSample.data` is initialized with
an empty `Uint8Array` which is always replaced before the sample is
pushed into the `videoSamples` array, so to avoid creating a new empty
placeholder `Uint8Array` for each sample, the empty `Uint8Array` can be
created once and then use to initialize all `lastVideoSample` objects in
that segment.

`TSParser.parsePES_` had a similar placeholder empty `Uint8Array` issue,
which I was able to resolve by creating the PES object in the return
statement instead of upfront, that way it can be initialized with the
final data, avoiding the placeholder.

While yes empty Uint8Arrays definitely need less memory than larger
ones, it is still better to not create 100+ unnecessary objects in rapid
succession which then need to be cleaned up by the garbage collector
later on.
2026-05-18 10:46:42 +02:00
absidue 45c86eaca1 chore: Tidy up array pop() with subsequent re-push() (#10099) 2026-05-18 10:46:42 +02:00
Ivan adbcec3bd2 perf(player): avoid full configuration deep-clone in time update callback (#10098)
This PR replaces a full-config deep-clone in Player.getBufferFullness()
with a direct read, removing a per-timeupdate allocation for playback
sessions that have liveSync configured, or `vodDynamicPlaybackRate`
2026-05-18 10:45:57 +02:00
absidue 6494c19526 perf(transmuxer): Reduce per-frame object allocations for h265, ac-3 and ec-3 (#10094)
This improves TS h265, TS AC-3, TS EC-3, raw AC-3 and raw EC-3 as the
transmuxer calls `parseFrame` for each frame in the payload passed to
the `transmux` method, for LOC h265 this is marginally worse as it only
calls `parseFrame` once per `transmux` call.
2026-05-18 10:45:55 +02:00
Álvaro Velad Galván 8172f5eb1a chore(Mp4Parser): introduce boxes() for multiple box registration (#10091) 2026-05-18 10:45:39 +02:00
absidue 7e030d93df chore: Make Mp4Generator.allocBox_ private and use it more (#10092) 2026-05-18 10:45:38 +02:00
taylorchu 4ab4e95649 fix: fix opus transmux sample duration (#10090)
We recorded a h264 + opus video and audio stream with chrome
mediarecorder api.

From debug mode, I noticed that transmuxed opus chunk was 3x shorter
than video, but ffmpeg showed that they should be about the same.

It turns out the duration is not set correctly. Before the fix, repeated
seeking will eventually get stuck. After this fix, I can verify that
seeking no longer is stuck.

Co-authored-by: Claude <noreply@anthropic.com>

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2026-05-18 10:45:37 +02:00
Álvaro Velad Galván 45be4842a0 fix: force gap jump when stalled at the end of a buffer (#10086)
Ensures the GapJumpingController identifies gaps even if the playhead
hasn't technically exited the previous buffered range
2026-05-18 10:45:15 +02:00
Álvaro Velad Galván 972b57b306 fix(Offline): Only request the license on download when usePersistentLicense is true (#10074)
Fixes https://github.com/shaka-project/shaka-player/issues/10038
2026-05-18 10:45:15 +02:00
Ivan 1d987d71b2 perf(HLS): skip rebuilding known refs on live playlist refresh (#10075)
This PR reduces steady-state work during HLS live/DVR playlist refreshes
by avoiding already known segments' re-construction. Before this, on a
live playlist update, the parser would still call
createSegmentReference_() for every segment, though only the newly
appended tail was actually merged into the segment index.
2026-05-18 10:45:15 +02:00
Shaka Bot f1bf1d79a3 chore(v5.1.x): release 5.1.4 (#10081) 2026-05-11 13:38:18 +02:00
Álvaro Velad Galván 6a4b7aa739 fix(text): include regionAnchorX/Y in region cache key (#10073)
Region elements were cached by an ID that omitted regionAnchorX and
regionAnchorY, causing regions that shared the same viewport anchor but
differed in region anchor to reuse a previously cached DOM element
positioned incorrectly. Include both region anchor values in the
generated ID so each unique anchor combination gets its own element.

Issue: https://github.com/shaka-project/shaka-player/issues/2583
2026-05-11 11:07:29 +02:00
Ivan fad81e64d1 perf(media): replace slice with in-place array truncation (#10070)
This PR removes slice for a simpler truncation - especially good for
`merge` because we just truncate from the back. No need for allocation
for none of them anyway so this is an easy win
2026-05-11 11:07:29 +02:00
0xDragonLong 3dc5afff29 fix: Avoid race condition in concurrent getAllThumbnails calls (#10022) 2026-05-11 11:07:29 +02:00
absidue 94a82e0ecc perf: Remove unnecessary Uint8Array allocations in Mp4Generator (#10069)
Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2026-05-11 11:07:29 +02:00
Álvaro Velad Galván bd3960ad06 perf: Remove unnecessary allocations in Mp4Generator (#10059) 2026-05-11 11:07:29 +02:00
Álvaro Velad Galván ecd2c2da81 chore: Use shaka.drm.DrmUtils.isClearKeySystem where possible (#10058) 2026-05-11 11:07:29 +02:00
Álvaro Velad Galván c3d593d504 chore: Remove duplicated code (#10057) 2026-05-11 11:07:29 +02:00
Álvaro Velad Galván e810f08d19 fix(MSF): handle WebTransport.closed rejection to avoid Safari unhandled promise error (#10056) 2026-05-11 11:07:29 +02:00
Shaka Bot 48a5d65371 chore(v5.1.x): release 5.1.3 (#10054) 2026-05-04 14:03:09 +02:00
Ivan 2227133afb perf(DASH): lazy segment reference creation (#10050)
This PR extends work from #5061 to DASH SegmentTemplate@duration streams
by lazily creating fixed-duration segment references instead of building
the full index up front during manifest parsing
2026-05-04 12:50:05 +02:00
absidue 004ff8dfd2 perf: Remove unnecessary Uint8ArrayUtils.concat calls in Mp4Generator (#10047)
`Mp4Generator.box()` merges all arguments into one `Uint8Array`, so
arrays of `Uint8Arrays` can be spread directly into the
`Mp4Generator.box()` calls instead of doing the extra step of merging
them into a single `Uint8Array` first. I also included a drive-by change
to simplify `array.push(...[x, y])` into `array.push(x, y)` in the
`segmentData` method.
2026-05-04 12:50:05 +02:00
absidue 270f7ea751 perf(transmuxer): Merge consecutive Uint8Arrays in h265 transmuxer (#10046) 2026-05-04 12:50:05 +02:00
Shaka Bot 07b3e051cc chore(v5.1.x): release 5.1.2 (#10034) 2026-04-27 16:59:53 +02:00
Álvaro Velad Galván 7751d5abb5 chore: Simplify shaka.util.Mp4Generator.StreamInfo info (#10029) 2026-04-27 14:48:34 +02:00
Álvaro Velad Galván 1d4fc9c7de chore: Remove videoNalus of shaka.util.Mp4Generator.StreamInfo (#10028)
This was used only for MSS, but we have now removed support for it.
2026-04-27 14:48:34 +02:00
Ivan 9cfcf89a26 perf(segments): use binary search for segment lookup in more hot paths (#9997)
This PR replaces more linear scans with binary search in more segment
lookup methods - optimization is aimed at long DVR livestreams on
low-end TV devices
2026-04-27 14:32:55 +02:00
Fredrik Höglin 0e2e05259f fix: avoid pts rollover correction for fmp4/cmaf streams (#10021)
For HLS CMAF streams with WebVTT subtitles with large timestamps, the
rollover wrapping prevents the cues from being shown at the correct
time.

By adding a check to only do the wrapping for MPEG-TS streams this
problem is eliminated.

fixes #10020
2026-04-27 14:32:55 +02:00
Álvaro Velad Galván 6b71b6aafe fix: Allow use preferredText with external tracks (#10019) 2026-04-27 14:32:55 +02:00
Álvaro Velad Galván 2ada128ce5 chore: Remove appspot references from source (#10015)
Issue https://github.com/shaka-project/shaka-player/issues/9984
2026-04-27 14:32:55 +02:00
Álvaro Velad Galván e79bb88c02 fix(ABR): Fix playbackRate calculation when using droppedFrames (#10011) 2026-04-27 14:32:55 +02:00
Matthias Van Parijs 61685fcc4b fix: Bail out on initial text preference when a user selected one manually. (#10010)
```js
player.addTextTrackAsync("...", "en", "subtitles");
const textTracks = player.getTextTracks();
// Text tracks has a length of 1, but immediately selecting it would fail.
player.selectTextTrack(textTracks[0]);
```

Text track preference runs after we manually selected a text track, in
`src=` we'd wait for `loadeddata` before figuring out which initial text
track should be selected. The fix is to bail out when we already have a
text track active when trying to select an initial text track.
2026-04-27 14:32:55 +02:00
Álvaro Velad Galván d67dc4b9cf fix: handle AC-4 immersive stereo (IMSA) in HLS and DASH spatial audio detection (#10007)
More info:

https://ott.dolby.com/OnDelKits/AC-4/Dolby_AC-4_Online_Delivery_Kit_1.5/Documentation/Specs/AC4_HLS/help_files/topics/hls_playlist_c_codec_indication_ims.html

https://ott.dolby.com/OnDelKits/AC-4/Dolby_AC-4_Online_Delivery_Kit_1.5/Documentation/Specs/AC4_DASH/help_files/topics/MPEG_dynmc_adpt_strmg_c_mpd_for_ims.html
2026-04-27 14:32:55 +02:00
Shaka Bot ac0bf29157 chore(v5.1.x): release 5.1.1 (#10005) 2026-04-20 14:11:53 +02:00
Ivan 9b32a7a800 perf(HLS): skip merging known segments on live playlist updates (#9998)
This PR reduces redundant work on every live HLS playlist poll by
avoiding a full segment array re-merge when no new segments have arrived
- hls.js does this in a similar fashion in mergeDetails:
https://github.com/video-dev/hls.js/blob/master/src/utils/level-helper.ts
2026-04-20 12:08:45 +02:00
Álvaro Velad Galván 1824679813 fix(HLS): Fix SAMPLE-AES identity stall at waitingforkey event on track switch (#10000)
Fixes https://github.com/shaka-project/shaka-player/issues/9999
2026-04-20 10:57:30 +02:00
Álvaro Velad Galván 9692dee606 fix: Clamp playback rate to 16x and improve playhead movement behavior (#9996)
Technically the spec does not impose a maximum limit, but browsers do
not reliably support playback rates above 16x. For rates greater than
16x, we fall back to the trick-play mechanism used for negative playback
rates.
2026-04-20 10:57:30 +02:00
Karim Laham 0fdced6725 fix: Avoid uncaught TypeError when destroying player during DRM key status change (#9992) 2026-04-20 10:57:30 +02:00
Álvaro Velad Galván ba21789c3d fix(MSF): Fix namespace handling (#9988)
Also adds new MSF test streams
2026-04-20 10:57:30 +02:00
Shaka Bot 2072a97f0d chore(main): release 5.1.0 (#9682) 2026-04-15 16:30:28 +02:00
Wojciech Tyczyński 7e18f8ca09 fix: Fix MIME type detection for uppercase types (#9976)
#9416 introduced case insensitive matching for ManifestParser detection.
To add a feature parity, the same should be added for src= detection.
Lack of it may cause issues with proper detection of native playback
capabilities and accidental preference of MSE over src=.

Logic has been shifted - now passed MIME type is lowercased by default
in `load()` and `preload()` methods. If MIME type is not present,
`NetworkingUtils.getMimeType()` guarantees to return lowercase variant.
2026-04-15 13:00:24 +02:00
dong-heun 0f322b08bb fix: include unencrypted decodingConfigs in preferredKeySystems loop (#9975)
HLS SUPPLEMENTAL-CODECS (e.g. Dolby Vision dvh1) creates duplicate
variant tags with different codecs but the same media playlist URI. Due
to lazy-loading, only one variant gets its drmInfos populated via
createSegmentIndex(). The other variant remains with empty drmInfos and
is treated as unencrypted by getDecodingConfigs_().

In the preferredKeySystems loop, the filter rejected these unencrypted
configs (undefined !== preferredKeySystem), leaving the variant with no
decodingInfo and causing it to be dropped.

Fix: allow unencrypted configs (!keySystem) to pass through, matching
the pattern already used in the second (fallback) loop.

Propagating drmInfos in HLS parser would be more correct but is complex
because stream duplication happens at the tag level with separate cache
keys (URI + codecs) in createStreamInfoFromVariantTags_.
2026-04-15 12:39:19 +02:00
Phil Harrison 657f31adfb feat(Ads): Add _HLS_start_offset support for X-ASSET-LIST in HLS Interstitials (#9967)
Close https://github.com/shaka-project/shaka-player/issues/9962
2026-04-15 12:38:23 +02:00
Álvaro Velad Galván 90a737961f feat(MSF): Add MoQT draft-16 support (#9966)
A new config is added to config the version: 'auto', 'draft-14',
'draft-16'

---------

Co-authored-by: Wojciech Tyczyński <tykus160@gmail.com>
2026-04-15 12:34:33 +02:00