Commit Graph

18 Commits

Author SHA1 Message Date
Álvaro Velad Galván 35124e4071 fix(Demo): Fix keep custom config on page reload (#8777)
The previous fix doesn't work with streaming.lowLatencyMode config.
2025-06-21 07:23:08 +02:00
Wojciech Tyczyński 769ced524d fix: Use proper method for checking is object an array (#8644) 2025-05-26 17:03:44 +02: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
Joey Parrish 90e47eb58a fix: Avoid stack overflow when stringifying objects (#7721)
Add special case for arrays, for compatibility with frameworks or
polyfills that add properties to Array or Array instances.

Add special case for functions, which always contain circular references
and are unexpected in this context. These seem to appear because of the
frameworks/polyfills mentioned above.

Move everything to ObjectUtils, since this is extremely generic.

Closes #7435
2024-12-06 14:39:19 -08:00
Wojciech Tyczyński 55b7bd0a70 fix: Forbid usage of instanceof ArrayBuffer (#7653)
Fixes #6279
2024-11-26 11:16:00 +01:00
Wojciech Tyczyński 6f84e411ed fix(PS4): Fix serverCertificate defaulted to null (#6716)
For some reason on PS4, the check `val.buffer.constructor == ArrayBuffer` returns `false` when it should be `true` which causes the object cloning to return `null` instead of the array buffer.

Modifying this to `val.buffer instanceof ArrayBuffer` now returns true which fixes the issue. This should work across devices.
Original author: @nick-michael

Co-authored-by: Nick Michael <nick-michael@users.noreply.github.com>
2024-05-31 09:44:04 -07:00
Ivan daa9d1f206 perf(utils): use WeakSet to track object references (#5791)
This change removes `Set` in favour of `WeakSet` to track seen objects
while cloning for performance reasons

From MDN:
`
The number of objects or their traversal order is immaterial, so a
WeakSet is more suitable (and performant) than a Set for tracking object
references, especially if a very large number of objects is involved.
`

---------

Co-authored-by: Ivan Kohut <ivan.kohut@lamin.ar>
2023-10-23 10:42:15 +02:00
Rahul Kamat b36194878e fix: add strictMissingProperties suppressions to unblock strict missing properties on union types. (#4371)
JSCompiler's strict missing properties on union types change improves the missing properties check to report properties that do not exist on all members of union types (excluding null or undefined and after boxing primitives).
2022-07-22 15:07:20 -07:00
Joey Parrish f539147d48 fix: Correct license headers in compiled output
This fixes all the license headers in the main library, which corrects
the appearance of the main license in the compiled output.

It seems that the `!` in the header forces the compiler to keep it in
the output.  I believe older compiler releases did this purely based
on `@license`.

Issue #2638

Change-Id: I7f0e918caad10c9af689c9d07672b7fe9be7b2f3
2020-06-09 16:05:09 -07:00
Joey Parrish 64896d70b0 Use shorter license header
This reflects changes in Google's policy on JavaScript license
headers, which should be smaller to avoid increasing the size of the
binary unnecessarily.

This also updates the company name from "Google, Inc" to "Google LLC".

Change-Id: I3f8b9ed3700b6351f43173d50c94d35c333e82b4
2019-11-22 18:18:36 +00:00
Joey Parrish 08cec995c9 Replace find/get callbacks with SegmentIndex
This replaces find/get callbacks in Stream with a SegmentIndex.  With
the exception of DASH's SegmentTemplate+duration, all manifests were
already backed by SegmentIndex.  Now, all manifests are backed by
SegmentIndex.  This will simplify Period-flattening, in which all
tracks will be represented by a list of segments, some of which come
from different Periods.

The SegmentIndex in Stream will not be created until
createSegmentIndex is called.  Prior to this change, the find/get
callbacks could be invoked without createSegmentIndex() in some cases
(excluding DASH's SegmentBase), which some lazy tests took advantage
of.  Now that find/get are methods on SegmentIndex, createSegmentIndex
must be called in all cases.  The tests have been updated accordingly.

Making SegmentIndex generation async in all cases exposed some issues
with the parser context being modified in-place between one
Representation and the next.  So the parser now makes a shallow copy
of the context before it is bound into an async callback.

To facilitate updating the SegmentIndex for SegmentTemplate+duration
content, SegmentIndex now has a method to update its list on a timer.
Once per segment duration, the index will be updated to add and remove
SegmentReferences.

The initial expansion of SegmentTemplate+duration will be limited to a
relatively small number of segments, to avoid excessive CPU or memory
consumption.  This defaults to 1000 segments, but is configurable.

Issue #1339

Change-Id: I99c007b1096c3b396d04a729750cd7b743cb899d
2019-07-08 22:22:13 +00:00
Jacob Trimble 43e798870f Misc ES6 conversions.
Issue #1157

Change-Id: Ia25a6cae84575f003980e9694b2769f2976e1342
2019-06-03 15:31:57 +00:00
Jacob Trimble f130dffcef Enable eslint indentation rule.
This is a fully automated change.  The linter will fail because the
extra indentation caused line-length errors.  These won't be fixed
automatically.  They are fixed in a follow-up to make this one fully
automated.

Change-Id: I4d8cf9c998985add2bcd24a81c8d65495668c4f3
2019-05-13 22:31:09 +00:00
Jacob Trimble 0dd64074b9 Only allow one statement per line.
With the new style rule, we cannot have two statements on the same line.
So we can no longer have an "if" on a single line and we cannot have
an arrow function with a body on the same line as when it is used.
This is mostly a manual change.

Change-Id: I2285202dd5ecbad764308bc725e6d317ff2ee7f0
2019-05-13 22:11:50 +00:00
Jacob Trimble c81389741f Prefer const over let.
A coming update to the Google eslint config will require using "const"
over "let".  This makes that one change to isolate the big changes.

Change-Id: I7d0974c3ae15c53cc45a6b07bf9f6586e2d34aca
2019-05-08 09:22:10 -07:00
Joey Parrish 7091275cbf Replace indexOf with includes, startsWith
This replaces almost every instance of indexOf on both String and
Array.  There are very few places where we really wanted an index.
Mostly, indexOf was used to check for inclusion.

Change-Id: I08e299768b6ffdb4bfc30b39b5d82a058c6d1b56
2018-09-14 19:10:56 +00:00
Joey Parrish 49c7c0c94c Fix advanced DRM settings pollution across key systems
When merging config objects, we accidentally used the same object
reference for multiple key systems.  This caused settings meant for
one to affect another.

The clone util had to be updated to handle Uint8Arrays, which may be
present in DRM configs.

Closes #1524

Change-Id: I66c8dc114573605471b1eeb38e890bbd4d29e2d4
2018-08-29 17:14:37 +00:00
Theodore Abshire f6a1c6e4aa Moved cloneObject to new util file
cloneObject used to be part of config_utils.js.
This meant that a number of classes that didn't actually use
config objects required ConfigUtils.
This moves cloneObject into the new ObjectUtils, to clarify that.

Change-Id: I92d630eba8798b3e2671dcce95b61f44282b05e7
2018-08-07 13:15:06 -07:00