Commit Graph

68 Commits

Author SHA1 Message Date
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 47daf49f31 Use arrow functions for callbacks.
This is an automated change to convert use of "function" functions
to arrow functions.  This doesn't change all uses of bind() that
could be converted.  This also doesn't remove all "function" functions.

Change-Id: I40ac7d086bcef947a1be083359c8fd1d4499a9c3
2019-05-09 16:40:46 +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
Jacob Trimble a453095412 Misc fixes for const.
This prepares some changes for the conversion from "let" to "const".
This ensures the follow-up is just an automated change with minimal
intervention.

Change-Id: I19b24dc67f20038dffd36b8903547f6ee4f00c25
2019-05-08 16:17:58 +00:00
Tyler Daines 3c8241f3c7 Add license url parsing (#1644)
This adds parsing license URLs to the DASH parser so the URL can be embedded in the manifest.

Fixes #484
2018-12-13 10:58:27 -08:00
Jacob Trimble 140105b0a2 Optimize processXlinks.
- Only traverse children once.
- Avoid traversing into SegmentTimeline, which is usually large and
  won't contain xlinks.

Issue #1640

Change-Id: I8a7a05d580740f9a9953b0a8aec89a06cc7e33f2
2018-10-24 11:38:36 -07:00
Joey Parrish 96237671d7 Avoid assertions about $Time$ when it is not used
In some environments, goog.asserts.assert can cause an exception to be
thrown.  Therefore, we must avoid spurious assertion failures.

In this case, the assertion about $Time$ could fire even if $Time$ was
not being used in the URI template.

Change-Id: Idba351989cd439f5202373d1ecb71804b372705e
2018-08-13 09:59:28 -07:00
Joey Parrish fd0449d8f7 Re-enable some disabled style rules
This re-enables the following style rules:
  - "block-spacing"
  - "brace-style"
  - "comma-dangle"
  - "comma-spacing"
  - "new-cap"
  - "no-multi-spaces"
  - "no-multiple-empty-lines"
  - "one-var"
  - "padded-blocks"
  - "prefer-rest-params"

Change-Id: I15d616e8d5b88b273ded6128b4f9ad86bdb26bd1
2018-07-09 19:44:56 +00:00
Joey Parrish 321896db3f Fix private annotations and names
These errors were discovered by a more up-to-date compiler.

Change-Id: Ic678e259406ac6fa43c4cb355ad72118cd563f57
2018-05-23 14:29:12 -07:00
Jacob Trimble 866b0e18ef Fix non-default namespace names in DASH.
XML allows namespace names to be any string.  So instead of looking
for the literal name 'cenc:pssh', we should be looking for the 'pssh'
name in the correct namespace.

Closes #1438

Change-Id: I724db3b7f0e60b4233b0fc40b1ed57698c6ce9ce
2018-05-21 20:02:18 +00:00
Michelle Zhuo 535de4db84 Refactor: Remove underscore from parameter names
Change-Id: Ie9e6fb59763f454f245175f23c6444f919ba8135
2018-05-08 19:21:51 +00:00
Sandra Lokshina 8065bd54a8 Change namespace from shakaExterns to shaka.externs
Change-Id: I16432351e2a266aa8fd175669aa27c44bfdffeae
2018-04-11 17:26:26 +00:00
Joey Parrish 772dc231c9 Remove non-nullable on implicit non-nullable types
This is a style cleanup to pass stricter checks from future versions
of the Closure linter.

Change-Id: Icca8f974af7c9f4834acf6bba69e4cef1f89e502
2018-04-09 14:52:59 -07:00
Jacob Trimble 938da032b5 Allow non-decimal formats in SegmentTemplate.
Fixes: 75988239
Change-Id: I023a1bd003662c6d651eb870b4aba025dc687327
2018-03-21 22:41:26 +00:00
Theodore Abshire 5ae80cc67d Typo fixes and rewording in comments, part 4
This makes a large number of small typo fixes. It also rewords a
number of comments and JSDoc descriptions, and does some
formatting standardization.

This doesn't fix every single issue, but it fixes a lot. Notably,
there were some formatting issues I declined to standardize due to
ambivalence on what the proper standardization would be; for example,
when and where empty lines should show up in JSDoc.

Change-Id: I5904ec91b96417a9ac5e19cb4f7b07a084f26ac8
2018-03-21 17:25:03 +00:00
Theodore Abshire dc17969822 Typo fixes and rewording in comments, part 1
This makes a large number of small typo fixes. It also rewords a
number of comments and JSDoc descriptions, and does some
formatting standardization.

This doesn't fix every single issue, but it fixes a lot. Notably,
there were some formatting issues I declined to standardize due to
ambivalence on what the proper standardization would be; for example,
when and where empty lines should show up in JSDoc.

Change-Id: I048b430e4c0bea2ccb9aec572d5e9ec6b606a87a
2018-03-14 17:59:26 +00:00
Jacob Trimble 624acc66b8 Add curly braces to all blocks.
Google style guide requires adding curly braces to all block statements
even if it is only has one line.  This fixes it by using eslint's
--fix flag followed by running clang-format to reformat the change.

Change-Id: Idc086c2aa8c02df5ef8b2140a11bfb9128eeb4bd
2018-02-21 11:23:34 -08:00
Jacob Trimble 29f39077dc Convert 'var' to 'let'/'const' (2 of 9).
This is part of a change to convert all usages of 'var' with either
'let' or 'const'.  This takes a conservative approach for 'const' where
it will only be used for aliases and storing the "original" values in
tests.

Change-Id: Iebba756b5d0e68c41292ecabda89503682d8d434
2018-02-14 00:38:06 +00:00
Joey Parrish f428ec83fc Use OperationManager in HLS and DASH parsers
This adds OperationManager to HLS and DASH parsers to allow them to
abort and clean up network operations when stopped.  We now re-enable
the player integration tests that were written to prove the previous
polling-based cancelation model.

Issue #829

Change-Id: Id09df6e3f2f40eef614d9e597d35f43a50e1673e
2018-01-29 19:23:47 +00:00
Joey Parrish 2f55d2a3bd Use AbortableOperation in networking
This uses AbortableOperation in all networking, from the scheme
plugins all the way to the request interface.

This also updates all default scheme plugins, docs, and sample code.

Backward compatibility is provided for scheme plugins and the
request API in NetworkingEngine.  This compatibility will be
removed in v2.5.

Two cancelation-related tests have been disabled in
player_integration until the new abort interface has been adopted
in the manifest parsers.

Issue #829

Change-Id: I91c8e6efe97798d111e8ddca5655cddc1f6bcbf3
2018-01-29 19:23:47 +00:00
Joey Parrish 74316c37d9 Add missing require statements
These were not caught by the compiler due to aliases used to access
them, but they were caught by some new linter tools I am trying to
integrate into the build.

Change-Id: I343d155d43285e8244376b95c95b08b5d4f2fa39
2018-01-03 22:29:45 +00:00
Joey Parrish 5166699e10 Fix PTO for SegmentBase
In DASH SegmentBase, we were not dividing presentationTimeOffset by
the timescale.  In all other instances of presentationTimeOffset in
DASH, we were handling it correctly.

This bug was present in all v2 releases until now.

The solution is not only to divide by timescale, but to rename all
internal uses of presentationTimeOffset to either unscaled or scaled,
to differentiate between those in timescale units and those in
seconds.  I believe inconsistent naming and units were a contributing
factor to the creation of the bug.

Closes #1099

Change-Id: Id561f8eb1f5bc011c606e1925c12f0d8183fd51a
2017-11-01 11:25:51 -07:00
Jacob Trimble adb8da4764 Disallow unknown properties (1/5).
This is part of adding a new conformance rule to add additional type
safety.  This will disallow using properties of unknown types or using
unknown properties.

The first parts will be fixing errors caused by the new rule.  These
are backwards compatible, so can be applied before the rule is enabled.
Once all the errors and bugs are fixed, the rule will be enabled.

Change-Id: Iefde089b2f62ddfdf43944cda5badab438577561
2017-06-27 19:43:00 +00:00
Theodore Abshire 1e119e40cf Adds option to fail gracefully on xlink failure.
At the moment, when there is an xlink problem, the manifest parser
returns a rejected promise. This adds a configuration variable to
instead simply not replace the xml tag.

Closes #788

Change-Id: Iace953233c83a57820130033150e7cd9a9385d6f
2017-05-25 21:10:09 +00:00
Theodore Abshire bdae795ae9 Fixed bug with nested relative xlink links.
Before, if a relative xlink contained another relative xlink,
the nested xlink link would resolve its URI based on the filename
of the parent link, rather than its final URI.

Change-Id: Ic42ad8bfbd8487b4d1da66d86117823800c447be
2017-05-09 21:47:32 +00:00
Theodore Abshire b641a24acf Removed uses of .children from processXLinks.
Element.children does not work on IE or Edge, so all uses of it
were refactored to use .childNodes instead.

In addition, Element.children was added to the ban list, to prevent
further problems like this in the future.

Closes #792

Change-Id: I33009f77dbb1f4afa9847e31b57fda324baba472
2017-05-09 19:15:50 +00:00
Theodore Abshire 723e6ad1bc Added basic xlink support.
This adds a utility to mpd_utils.js that filters a manifest and
automatically downloads and substitutes in the contents of any xlink
link.

This only supports xlink:actuate="onLoad"; "onRequest" would require
significant changes to our manifest processing pipeline.
It also adds a new field to INVALID_XML errors to indicate which
xml was invalid, to make the error more informative when called on
xml loaded by xlink links.

Also added a demo asset.
This is just a simple modification of heliocentrism to break it into
multiple files.

Closes #587

Change-Id: If87b1e78e65261dcc4e043b0c2e6cf69c1b12e08
2017-05-08 14:00:56 -07:00
Sandra Lokshina cb11dac389 Fit segment references to the period length in HLS parser.
b/36070874
b/35849456

Change-Id: Ibd64b02dd98d2ff6db175412e5f44dc5e872d767
2017-03-14 10:32:41 -07:00
Jacob Trimble d51079516e Fit segments to Period for live content.
We usually fit segment references to the Period for VOD content.  This
ensures that a gap in the manifest at the end of the Period doesn't
cause problems.  We don't do this for live because we may get more
segments.  However, for multi-Period live, we should still fit the
references for all Periods except the last one.

This also removes the error about duplicate Representation IDs for
VOD content since the problem only occurs for live.

Issue #694
b/35849085

Change-Id: Ib195dc51982ca58b8d5613b37817216980b8d366
2017-03-09 21:03:23 +00:00
Torbjörn Einarsson 547a88c1b5 Improvement of segment timeline $Time$ accuracy (#706)
Fix incorrect timeReplacement when large timescale

The current code essentially does this

    timeReplacement =
	(startTime / timescale + presentationTimeOffset) * timescale

When timescale is large enough (e.g. 10 MHz in order to support MS
Smooth Streaming as well), "startTime / timescale * timescale" may not
always be exactly "startTime" because of floating point precision,
which could produce incorrect segment URLs.

Keep startTime and presentationTimeOffset unchanged in the timeline
just to avoid the multiply/divide dance.

Closes #690
2017-02-22 13:46:22 -08:00
Joey Parrish 6cfd337680 Remove unnecessary triple-equals usage
Change-Id: Ibfd76f8b36926e41e9bf2fd26b5bea16d3bd8f2a
2017-02-06 22:20:09 +00:00
Sandra Lokshina 87073c9afa Create ManifestParserUtil common to dash and hls parsers.
Both DASH and HLS parsers will be using resolveUris() and possibly
other methods in the future.
Create a ManifestParserUtil for the shared methods.

Issue #279.

Change-Id: Iaa5e32ec543a390341a54752563a9f27251f0832
2017-01-19 23:34:25 +00:00
Joey Parrish 3cad924cf1 In-progress recording (IPR) support, phase 2
Behavior for IPR streams:
 * offline storage disallowed
 * segment references will not be stretched to the period
 * seek range starts at 0
 * seek range end is calculated like the live edge
 * seek bar is from 0 to duration, not the seek range

Closes #477

Change-Id: Ia36874bb7208c2473c79cb817395ce03925b8c95
2016-08-29 19:57:15 +00:00
Joey Parrish eafe954d0c Replace Number.POSITIVE_INFINITY with Infinity
This is supported on all browsers, is more compact, and is easier to
read.

Change-Id: I96576dc341e093b7be9ef94fe36595c945b063c1
2016-08-29 18:56:54 +00:00
Joey Parrish da03f4391a Revert in-progress recording (IPR) support
These patches and IPR support in general will be revisited when we
have a better model for how this should work.

Closes #463

Change-Id: I2c5fe372986a9af232b052c67f8e5c3ba6585cee
2016-07-28 16:49:08 -07:00
Seth Madison ab86551814 fitSegmentReferences: live check should consider timeShiftBufferDepth
If we rely on duration != null in-progress recordings get their
last segment stretched to the end
2016-07-01 17:06:51 -04:00
Jacob Trimble a3c1ed29d4 Defer filling URI template until request is made.
Instead of filling the URI templates when parsing the manifest,
wait until the request is made to fill it.  This reduces the time
it takes to parse the manifest.

This was tested using a stream with a 24-hour timeShiftBufferDepth.
Using a Chromebook pixel running Chrome 51.  The average manifest
parse time was about 1 second before, now it is about 200ms.

Issue #405

Change-Id: I89f36085441f6c6b7d6281b24b671dc668f23fe5
2016-06-23 21:15:19 +00:00
Timothy Drews 1108700f10 Use segment info to adjust the pres. timeline.
* Permit non-zero presentation start times for VOD: some
  presentations have segments which start too far from 0 to
  allow the video element to begin playback; now the player will
  start VOD presentations from the start of the first segment.
  However, segments of the 2nd, 3rd, 4th, etc., Period of a
  multi-Period presentation must still start close to 0 (the
  player will not jump any gaps in the presentation).
* Prohibit seeking to regions at the beginning of the segment
  availability window if segment information is missing from
  that region: sometimes live manifests do not contain all the
  segments in the segment availability window; now the player
  will prohibit seeking to these regions.
* Update definition of live in DashParser to match Player and
  Playhead.
* Simplify PresentationTimeline's constructor by just using setter
  functions.

Issue #341
Closes #348
Issue #357

Change-Id: I96c22774448476bea89ff4014f03b87bdb51ba07
2016-04-26 21:09:57 +00:00
Jacob Trimble cc243faac9 Improve live stream support
* Support minimumUpdatePeriod="PT0S".
* Fix comparisons with very large timestamps.
* Assign default Period ID if not given.
* Increase suggestedPresentationDelay.

Closes #331
Closes #339

Change-Id: I091cb7ab3e2a1cdb38e4161fe139a96a10de3807
2016-04-21 23:38:04 +00:00
Joey Parrish a9b4cd89d0 Merge pull request #315 from cmgrecu/master
Update end time of last segment in a period when new periods are added

Fixes #310
2016-03-29 13:28:37 -07:00
Jacob Trimble 8b85e58f73 Add several utility functions.
Change-Id: Ifbd2582747d2cb54d4abda789b0989b7a6b77aa6
2016-03-29 20:17:44 +00:00
Costel Madalin Grecu 013f1e6478 Remove outdated todo item 2016-03-29 11:24:15 +03:00
Costel Madalin Grecu c0e0aef46d Fix presentationTimeOffset handling in v2 #297 2016-03-16 12:08:06 +02:00
Jacob Trimble 19973d63f4 Changed copyright headers from 2015 to 2016.
Change-Id: I429ff27e4794c03b7ea392e38415075077f9bfb1
2016-03-15 16:32:13 -07:00
Joey Parrish 4e7a0c2258 Correct segment fit check
The sense of the condition was inverted, causing final references not
to be fit to the period

Change-Id: I4b83643ae029e0bf285be37238418c827fd3093b
2016-03-15 14:35:48 -07:00
Timothy Drews 1007ffbc5e Fit SegmentReferences into their Period.
This ensures that small gaps from the start of the Period or from the
end of the Period are not interpreted as missing SegmentReferences.

Change-Id: I7492faef8e44067494e3daf3ff73742fa914d1e3
2016-03-15 13:50:19 -07:00
Jacob Trimble 8daf53e329 Renamed shaka.asserts to goog.asserts.
Using goog.asserts will work with the compiler.  So rather than
simply casting a nullable value when passing to a method, we can use
an assert which will correct the type and print a log if it somehow
is null.

This is not the same goog.asserts found in closure library, this
simply calls console.assert, but it is not required to do anything
for the compiler help.

Change-Id: I2548e39e772f0aa7ec41437cf9f5a2be383e0fbd
2016-03-11 15:29:20 -08:00
Jacob Trimble 846e7beb48 Unified comment spacing.
Before there were two style to indent comments after an annotation,
using 2 and 4 spaces.  Now this only uses 2 spaces.

Change-Id: Id06415d7193cc154a2768fb3932aff7a06b7ed32
2016-03-10 16:27:45 -08:00
Jacob Trimble 56d9bebc8e Fix DASH manifest parser when compiled.
The use of strings as indexers in the DASH manifest parser would
not work when the library is compiled.  This fixes it as well as
adding type-safety to those parts.

Change-Id: Id07068bc0eefdab4730dadc114e66b661cd4bb3e
2016-02-19 17:03:02 +00:00
Joey Parrish 4aea4d0d5f Fix $Time$ rounding errors in SegmentTemplate
Sometimes the calculated $Time$ value is not an integer due to
floating-point rounding errors, but the $Time$ value filled into the
template must be an integer.

Change-Id: I5e61ac5143222620e8b5e1dfeb1847241c6a6876
2016-02-12 10:31:46 -08:00