Commit Graph

57 Commits

Author SHA1 Message Date
Álvaro Velad Galván 2c4499f153 chore(Mp4Parser): introduce boxes() for multiple box registration (#10091) 2026-05-14 22:56:06 +02:00
Álvaro Velad Galván 6826ffa311 feat(CEA): Implement raw CEA-608 packet extraction (#9730)
This format is generated by Apple's HLS tools.
2026-02-19 11:45:18 +01:00
Andy(김규회) 05b09728c7 perf: Use Map.getOrInsert/getOrInsertComputed native methods (#9546)
Added polyfills for `Map.getOrInsert()` and
`Map.getOrInsertComputed()` from the TC39 upsert proposal and refactor
the codebase to use them.
These methods replace the common "check if key exists, then set default"
pattern with a single atomic operation. This improves code readability
and eliminates redundant map lookups throughout the player.

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2026-01-13 10:57:25 +01:00
Joey Parrish 849bff1db3 fix: Audit all usage of readBytes for memory leaks (#9027)
Make cloning buffers (or not) explicit in readBytes.

When we use a range of bytes temporarily for further parsing, we pass
clone=false and get a view on the existing memory buffer. When we want
to store the range of bytes, we pass clone=true and avoid holding a
reference to an entire segment in memory.

The call for the EMSG parser in MediaSourceEngine had an explicit clone,
but now uses the new clone parameter. This is not a functional change,
though.

The only readBytes call that changed in this audit was in the UI seek
bar.

The rest all appear to be values for temporary usage, and so are not
being cloned.

The new `clone` parameter will require future callers of `readBytes()`
to think about their purpose and make a choice.
2025-08-27 10:49:48 +02:00
Wojciech Tyczyński f1768a5f84 chore: Remove JSDoc for empty constructors (#8955)
We don't need this anymore with `exemptEmptyConstructors` config added
in #8901
2025-08-05 13:06:00 +02:00
Joey Parrish 7c1e31d4e6 chore: Add trailing commas to all record types (#8820)
Now that jsdoc supports this, it will make future diffs cleaner. See
#8819 and #1236.
2025-06-30 13:36:04 -07:00
Álvaro Velad Galván 231dd03dbd fix: Avoid throw BUFFER_READ_OUT_OF_BOUNDS when not necessary (#8753)
This only happens when a stream has incomplete mp4 boxes.
2025-06-17 13:10:29 +02:00
Álvaro Velad Galván 49c228c713 fix(CEA): INVALID_MP4_CEA error being thrown when shouldn't be (#8748)
Fixes https://github.com/shaka-project/shaka-player/issues/8729
2025-06-16 11:47:11 +02:00
Álvaro Velad Galván 80c8a03c12 chore: Stop using "Object" in MP4-CEA annotations (#7951)
Related to #1672
2025-01-27 10:49:14 +01:00
Álvaro Velad Galván 3856c58396 fix(CEA): Fix multi byte language support in CEA-708 (#7929)
Fixes https://github.com/shaka-project/shaka-player/issues/7926
2025-01-23 11:47:19 +01:00
Darrin DuFord 19bd472893 feat: Save CEA708 caption cues on all windows when deleting/clearing windows (#7909)
Close https://github.com/shaka-project/shaka-player/issues/7907
2025-01-21 17:16:25 +01:00
Wojciech Tyczyński 6e55a3b21b build: Forbid using dot in generic types (#7904)
Fixes #2643

Happy reviewing!
2025-01-20 09:39:51 +01:00
Wojciech Tyczyński 82f7eafdc5 build: Add new JSDoc rules to ESLint (#7897)
Adds a replacement for removed JSDoc checks from ESLint v9.
Additionally fixes lots of issues found in the JSDoc, such as:
- missing `@param`/`@return` annotations
- bad formatting
- params order
- param name in the same line as type definition (tried to disable it,
but it was causing other issues and we didn't have lots of places with
such formatting)

Minor fixes in code found by Closure Compiler after fixing JSDoc are
also included.
2025-01-17 09:28:19 +01:00
Álvaro Velad Galván 5b13332cca fix(CEA): Fix multi byte language support in CEA-708 (#7837)
Fixes https://github.com/shaka-project/shaka-player/issues/7829
2025-01-07 13:23:53 +01:00
Wojciech Tyczyński 51765e9693 build: Change spellchecking tool and fix spelling mistakes (#7765)
Fixes #7693
2024-12-20 12:27:05 +01:00
Álvaro Velad Galván cdbbe232b1 fix: Fix support for Dolby Vision based in VVC (#7212)
Info from
https://dolby.my.salesforce.com/sfc/p/#700000009YuG/a/4u000000l6G4/4R18riPaaW3gxpVx7XwyQLdEITLFjB.w.Si0LoQR5j8
2024-08-26 22:53:14 +02:00
Álvaro Velad Galván 11a2cc5db2 feat(CEA): Support alignment in CEA-608 (#7022)
Closes https://github.com/shaka-project/shaka-player/issues/2940
2024-07-12 08:46:10 +02:00
Álvaro Velad Galván 230f6e0095 fix(CEA): Offset text CEA-608 that are out of viewport (#7024) 2024-07-12 07:19:39 +02:00
Álvaro Velad Galván a3d09a9431 feat(CEA): Add CEA support for VVC/H.266 (#6912) 2024-06-26 08:56:06 +02:00
Álvaro Velad Galván a3e1fdd0f8 fix(CEA): CEA-608 is not rendered in some cases (multiples TRAF boxes) (#6878)
Fixes https://github.com/shaka-project/shaka-player/issues/5919
2024-06-21 08:51:38 +02:00
Álvaro Velad Galván dd5658bc3b fix(CEA): Fix stream detection when the stream has not control codes (#6703)
Thanks @tykus160
2024-05-30 08:21:44 +02:00
Álvaro Velad Galván f69694a37f fix(CEA): Ignore XDS control codes (#6702)
Thanks @tykus160
2024-05-30 02:20:42 +02:00
Wojciech Tyczyński 024cb9b966 fix(CEA): reset PTS on new init segment (#6606)
Fixes #6605
Resets cache (including last used presentation timestamp) of CEA Decoder
on every init segment append.
Adds few debug logs to easify investigations in the future.
2024-05-14 11:19:26 +02:00
Álvaro Velad Galván e8f37f0d6c fix: Fix PES rollover in TS (#6363)
Related to https://github.com/shaka-project/shaka-player/issues/6320#issuecomment-1979835203
2024-03-29 13:33:58 -07:00
David HM Morgan 8cf9d59eac fix: Fix cea608 whitespace rendering (#6329)
Ensure whitespace rendered in CEA-608 test streams instead of `⠀` (braille pattern blank).
Updated UT too, but avoiding this char at ends of the string hence vulnerable to trim() 🤦 

Fixes #6328
2024-03-06 12:11:52 -08:00
Álvaro Velad Galván c100053532 feat: Add support for Dolby Vision based on AVC and AV1 (#6154) 2024-01-24 18:15:18 +01:00
Wojciech Tyczyński 44cb8a2ed8 fix: fix handling of multiple CC tracks (#6076)
Due to issue around channel calculation, shaka was never using CC4 track
and data from there were landing in CC2 track.
2024-01-10 16:17:10 +01:00
Álvaro Velad Galván 83f6f5379b fix(CEA): Fix positioning in CEA-608 (#5925)
See:
https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-608

Related to https://github.com/shaka-project/shaka-player/issues/2940
2023-11-27 09:48:06 +01:00
Gary Katsevman 2a524bf51f feat: expose CEA708 window position in the cue's region (#5924)
CEA708 captions have positioning data available in their windows.
However, this isn't currently translated and exposed by shaka though it
is parsed from the bitstream.

Translates the windows into WebVTT regions and uses the mappings
outlined
https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-708

This is also partially implements #2583.
2023-11-23 17:19:46 +01:00
Nick Crast 9a694b59f8 fix: CEA decoder should return early if packet is not large enough (#5893)
Fixes #5891 

In production, we are seeing the occasional SEI packet [`0x5b`], which
is causing the parser to error. Using Mux.JS, this packet is ignored
because it's not long enough to be a valid captions packet, so for
feature parity it would make sense for the built in Shaka parser to also
ignore.
2023-11-15 18:20:39 +01:00
Álvaro Velad Galván 754bfacf07 feat(HLS): Build closed captions metadata for media playlist on-the-fly. (#5811)
Related to https://github.com/shaka-project/shaka-player/issues/1826
2023-10-26 09:03:59 +02:00
Álvaro Velad Galván 54eaf6371a feat(CEA): Parse CEA from TS with H.265 (#5610) 2023-09-07 08:36:13 +02:00
Álvaro Velad Galván 47224ff081 feat(CEA): Add support to vertical position in CEA-608 (#5531)
Related to https://github.com/shaka-project/shaka-player/issues/2940
2023-08-25 06:52:44 +02:00
Álvaro Velad Galván c6e8449468 feat: Parses a TFDT Box, with a loss of precision beyond 53 bits (#5501)
Related to https://github.com/shaka-project/shaka-player/issues/3784
2023-08-19 05:29:49 +02:00
Joey Parrish 8ff29175d8 fix: Fix exception on Tizen due to unsupported Array method (#5429)
Tizen 3 does not support Array.flat(). This fixes a runtime exception on
Tizen 3 by replacing flat() with concat() and the spread operator. This
also bans the use of flat().

flat() was originally introduced in PR #5422
2023-07-21 06:53:30 -07:00
Joey Parrish bccfdbcea4 fix: Fix captions from MP4s with multiple trun boxes (#5422)
Closes #5328
2023-07-20 09:10:38 -07:00
Aidan Ridley f0ee16bdb3 fix: CEA 608 captions not work with H.265 video streams (#5252)
Fix parsing of CEA 608 captions in H.265 video streams by handling 2
byte nal unit header.

Fixes #5251
2023-05-31 21:14:28 +02:00
Wojciech Tyczyński 7bda65dcc7 feat: Convert CEA parsers to plugins (#5195)
Fixes #5178 

Changes included:
- converted CEA parsers to externs
- added API to register/unregister CEA parsers
- TextEngine now checks is CEA decoder registered
- excluded CEA plugin from core build
- added lcevc plugin to core build

Bundle size results (all in KB, compared to
bf4b4a54cc):


  | core | complete - ui | complete - ui - cea
-- | -- | -- | --
before | 246 | 473 | 473
after | 231 | 474 | 459
2023-04-28 17:23:01 -07:00
Álvaro Velad Galván d6001097a9 fix(cea): Fix not rendering CEA-608 on encrypted mp4 segments (#4756)
Fixes https://github.com/shaka-project/shaka-player/issues/4605

Co-authored-by: Joey Parrish <joeyparrish@google.com>
2022-12-01 22:34:34 +01:00
Álvaro Velad Galván e89eeb69fa fix(cea): Fix MAX_ROWS in CEA-708 window (#4757)
Fixes https://github.com/shaka-project/shaka-player/issues/3634
2022-11-28 11:34:37 -08:00
Álvaro Velad Galván 70fad8de8f feat(cea): Add CEA parser for TS (#4697)
Closes https://github.com/shaka-project/shaka-player/issues/3674

Co-authored-by: Joey Parrish <joeyparrish@google.com>
2022-11-28 18:56:22 +01:00
Álvaro Velad Galván a489282ff2 fix(cea): Fix not rendering CEA-608 Closed Captions (#4683)
Also added H265 support and a framework for future TS CEA parser support.

Fixes #4605
Fixes #3659

Co-authored-by: Joey Parrish <joeyparrish@google.com>
2022-11-10 13:39:19 -08:00
Maria Maddox b3621c26a8 fix: check for negative rows before moving (#4510)
Closes #4508
2022-09-27 18:16:58 +02:00
Álvaro Velad Galván 57c73241a0 fix(performance): Eliminate use of ES6 generators (#4092)
See: https://github.com/shaka-project/shaka-player/issues/4062#issuecomment-1077826210

Co-authored-by: @joeyparrish

Issue #4062
2022-04-04 10:58:16 -07:00
Álvaro Velad Galván 2687b95d58 fix(cea): make a more robust CEA MP4 parser (#3965)
Fix a HLS error reported in https://github.com/google/shaka-player/issues/2337#issuecomment-1040389975

Tested with https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_adv_example_hevc/master.m3u8
2022-02-24 13:27:18 -08:00
Joey Parrish d99ab7959d build: Update eslint (#3977)
Also fixes linter errors found by the new versions
2022-02-18 08:26:43 -08:00
Joey Parrish c482e81ad9 build: Update Closure Compiler (#3976)
This updates the compiler and closure library to the latest releases.
This required a few small tweaks:

 - Drop custom extern for WebCrypto (now built into the compiler)
 - Remove require() in cea parser, only used in `throws` annotations
 - Hack around a typing issue in a fake version of TextTrack in tests
2022-02-17 18:55:49 -08:00
enson-choy 6a775e29a4 fix: Fix CC parsing of EPB and v1 TKHD boxes (#3610)
When unboxing TKHD, the reader read int64 as trackId instead of int32. Thus unable to find matching timescale when doing TFHD unboxing. Therefore when parsing MDAT, the default timescale will be used which is 90000. All CC timestamps will then be incorrect.

This also fixes "Shaka Error MEDIA.VIDEO_ERROR (3,,PIPELINE_ERROR_DECODE: Failed to parse H.264 stream)" error when playing DASH MP4 H.264 streams with CEA-608 CC embedded.  It's likely that the VDA bundled in Chromium-based browsers have already included EPB detection & prevention. If we let the player to remove the byte, VDA will complain about stream conformance.

Closes #3502
2021-09-09 09:44:45 -07:00
Joey Parrish 38ce45dce5 cleanup: Fix nullability declarations
Cleanup imported from an internal Google migration process, courtesy
of Laura Harker.

Change-Id: I11de518eafe6008938589e5250bdcaf8151267e9
2021-06-22 21:03:20 +00:00
Joey Parrish 4c7767f6be cleanup: Delete unnecessary nested goog.provides
Cleanup imported from an internal Google migration process, courtesy
of Laura Harker.

Change-Id: Ied2c24eeacfe4ff92f1b974c8e960949de5e4fb5
2021-06-22 21:03:20 +00:00