Commit Graph

43 Commits

Author SHA1 Message Date
Joey Parrish 7e6a0f38ff fix: Correct license headers in misc. files
This corrects/normalizes license headers in misc. files, such as
config files, docs, build tools, tests, and externs.  This does not
affect the compiled output, and is only done for consistency.

Issue #2638

Change-Id: I9d8da2de55243b08d7df2b743aac73c6f15e858a
2020-06-09 16:13:56 -07:00
Joey Parrish 99de217c23 Remove periods from manifest structure
This removes periods from the internal manifest structure and cleans
up code and tests accordingly.  This leaves us unable to play
multi-period DASH & offline streams until the main period-flattening
algorithm is completed in shaka.util.Periods.

Three test cases have been disabled for the moment.

Multi-period playback will be restored in a smaller, more focused
follow-up commit, with disabled tests re-enabled.

Issue #1339 (flatten periods)
Issue #1698 (rapid period transitions issue)
Issue #856 (audio change causes bitrate change)
Closes #892 (refactor StreamingEngine)

Change-Id: I0cbf3b56bfdb51add15229df323b902f0b2e643a
2020-04-09 19:22:16 +00:00
Jacob Trimble 011749e95f Standardize argument comments.
This changes the eslint rule to enforce a strict pattern for the
argument comments.  The comment must appear before the argument and
must be /* foo= */.  This still ignores line comments.

Change-Id: I3afb01c65e1088eda13facb3aeeaa7595a2f5aee
2020-01-06 19:40:52 +00:00
Joey Parrish a48f8792a9 Move test-only method to test utils
This method should probably never have been in the library, since it
creates a fixed-sized, muted element.

Change-Id: I53b474305465bef34d43ce40ec5e7dedceb20a25
2020-01-06 18:57:28 +00: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
Sandra Lokshina 639005b124 Don't call mediaSource.endOfStream() more than once.
MediaSource throws if endOfStream() is called when
its readyState is equal to 'ended.' This happens if
endOfStream() has already been called.
This change ensures that we don't try to call endOfStream
on the MediaSource that has already marked as 'ended.'

Closes #2050.

Change-Id: I2672b297f0ebb7fd67afcf72ee52df6d5bacf761
2019-07-23 13:01:54 -07:00
Jacob Trimble 61d71df219 Convert media tests to ES6.
Issue #1157

Change-Id: I007f5dd43f297ca108cbb2caa7a9118527722350
2019-05-30 19:54:16 +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 381274fbbd Enforce a consistent dot location.
Change-Id: Ic3b86c4c113023206bc37a117e96f672f351121b
2019-05-09 21:09:30 +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
Sandra Lokshina 493d459c47 Add a DOM util.
Change-Id: Ia0941868f20dbb42fa0fe02a639015ac244a65ed
2019-04-05 12:01:59 -07:00
Aaron Vaage 0f0a3515b6 Refactor media source engine to take text displayer in constructor
Before, media source engine could be created with no text displayer.
However, player would always create media source engine with a
text displayer.

Just like with closed captions, this appeared to be a good time
to change it to be passed in the constructor and have media source
engine own it.

This now means that media source engine is responsible for destroying
it - lessening player's responsibilities.

Change-Id: I71cd1c28a3c22d3c765a3892fe74ae3f9abd1914
2019-01-24 01:12:37 +00:00
Aaron Vaage 39651c51b0 Refactor to have a central fake text displayer in tests
There we a couple different fake text displayers in our tests. This CL
take them all and consolidates them into one fake text displayer.

Change-Id: I889aa4f11660d641920b0628e7e91549cb715c6a
2019-01-22 19:13:31 +00:00
Aaron Vaage 25e92be2c8 Isolate and Highlight MuxJS Dependency
To make it clearer that the CloseCaptionParser uses MuxJS (and therefore
it requires MuxJS) it has been renamed to be MuxJSClosedCaptionParser. To
further isolate the dependency on MuxJS, the support check that we must do
before using the Caption Parser has been moved to a static function on the
parser.

Change-Id: If3385f192434d8f8ce0c1cadbc6365a7c5df9d5d
2018-12-26 21:16:49 +00:00
Aaron Vaage f09d5d7a6c Pass ClosedCaptionParser into MediaSourceEngine
Instead of requiring media source engine to create its own closed
caption parser and then allow tests to override it, have it be
passed into the constructor.

This allows us to easily use the fake one in all our tests and
removes the need for a test only method on media source engine.

Change-Id: Ia1d4f0bb988dca30699b30ccaf4522126f357f90
2018-12-07 00:10:13 +00:00
Michelle Zhuo a51bc995f7 Add integration tests for closed captions
Issue #1404

Change-Id: Id8c16c073f3f85fd093d33e3f40e809fa574f5ee
2018-12-05 00:07:59 +00:00
Michelle Zhuo 1afceadc9c Refactor Closed Captions Support for HLS
Refactor the closed captions support for HLS, using the same approach as
the closed captions support for Dash.
If closed captions are signaled in the manifest, player will create a
text stream for to represent the closed captions, and text engine will
store and append them. We don't need to set 'useEmbeddedText' value for
closed captions any longer.

Issue #1404

Change-Id: I9a5bf4df7e29d6e6982f29fd5e2df07bc78071d7
2018-11-27 20:59:52 +00:00
Michelle Zhuo 19a38ed6b5 CEA closed captions for Dash
Adding support for CEA closed captions embedded in video streams for
Dash.
1. Dash parser reads and parses closed captions' channel and language
information.
2. Player creates text streams for the closed captions.
3. Media Source Engine calls mux.js Caption Parser API to get the closed
captions embedded in the video streams.
4. Text Engine stores the closed captions, and text displayer shows the
captions.

TODO:
1. Add test cases, will send out another CL.
2. Change closed captions support for hls to the similar way we handle
dash closed captions, will send out another CL.
3. Handle dash content that's missing language indication from the manifest.

Issue: #1404
Change-Id: Ibae8f69623c13561415ec860107d7f5bc86e19e9
2018-11-06 09:53:18 -08:00
Joey Parrish 52a859321b Avoid autoplay restrictions by muting tests
While writing a new test to probe gap tolerance of browsers, I
discovered that only some of our tests run muted.  The others may be
subject to autoplay restrictions.  All tests should run muted.

Change-Id: Id5d5d611eb9ca95ea166a4542f38d41a67e280ac
2018-10-11 21:10:16 +00:00
Aaron Vaage 9f09df3000 Initialize MediaSourceEngine with Map
Changed MediaSourceEngine to be intialized with a map rather
than an Object.

Change-Id: I68cb26e7591cac8758abdaac0bffdf1901e0767e
2018-09-18 20:16:13 +00: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
Theodore Abshire cd7dcf5286 Added async/await to some of Media tests.
Issue #1337
Change-Id: I0cb350ad87d0b5448d9f87f7823dbf307131108b
2018-06-07 15:03:05 -07:00
Sandra Lokshina 8065bd54a8 Change namespace from shakaExterns to shaka.externs
Change-Id: I16432351e2a266aa8fd175669aa27c44bfdffeae
2018-04-11 17:26:26 +00:00
Theodore Abshire 4327153007 Loosen tolerance on CEA-708 captions test
On some platforms, the sample used in that test leads to a
buffer start time of 1.4; on other platforms, it leads
to a buffer start time of 1.4667333333333332.
Perhaps this is a result of the implementation-specific rounding
differences in different mediaSource implementations, or perhaps there
us a very small gap in the content that some platforms handle slightly
differently.

Either way, this change loosens the tolerance on the check. That buffer
start time check wasn't the important part of the test, anyway.

Fixes: 77471871
Change-Id: I866fafe671566cc7116e7c99222f75225cffd476
2018-04-02 14:11:31 -07:00
Theodore Abshire c5de6cb115 Add option to force TS transmuxing
Our support for CEA 708 closed captions only works if the container
video file is transmuxed. Because of that, we were not successfully
reading such captions on platforms with native TS support.
This change adds a configuration option to force TS to be transmuxed
even when unnecessary, to account for that situation.
It also adds an integration test to ensure that CEA 708 captions can
be extracted on every platform.

Closes #276

Change-Id: Id8b2a67f2327d1b69c9cdfc443e9592c99baf0db
2018-03-30 11:04:03 -07:00
Sandra Lokshina 6aae04ae29 Add setTextDisplayer() method to MediaSourceEngine.
Invoke the new method after a textDisplayer's been created.

Closes #1314.

Change-Id: I19891c845905a5a3509e74a93ebfe9a9c1ea7816
2018-02-22 23:47:40 +00:00
Joey Parrish b7bcafccc2 Move MediaSource setup to MediaSourceEngine
This isolates MediaSource code without changing the early
initialization of MediaSource, which was designed for low-latency
startup.

Prerequisite for #1087, #880, #997, #816

Change-Id: I61acedd95d73610d3e67436d9c7767d643fe2d29
2018-02-20 18:50:54 +00:00
Joey Parrish af73139d05 Set appendWindowStart in MediaSource
This avoids having media from one period replaced by media from the
next period.  Instead, media that comes before the period start will
be chopped off by MediaSource.

Closes #1098

Change-Id: Idf6dc2ffafe78214e94bc75aca63920e153f1a2c
2017-11-10 10:23:40 -08:00
Joey Parrish 3cd18bb336 Query platform MSE support using "extended" MIME types
Some platforms (such as Chromecast) support extra MIME parameters like
framerate, bitrate, width, height, and channels.  Since other
platforms will ignore these extra parameters, we should always query
using these parameters.

This introduces the framework to construct these "extended" MIME types
from Stream objects.  Extra parameters for other platforms can easily
be added later.

Change-Id: I8936ca93e84068da18f12127fbc8fc1a0646695a
2017-08-17 17:35:00 +00:00
Jacob Trimble 78fc6d9b36 Disallow unknown properties (2/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: I48335fc6659d3c33a6d55b00d087b59410c79cf7
2017-06-27 19:47:42 +00:00
Jacob Trimble e5ce395f37 Implement gap jumping.
The bulk of the logic for gap jumping is handled in Playhead.  It
tracks the current buffered ranges and jumps over any gaps that appear.
It listens for a special browser event ('waiting') for when the video
element runs out of playable frames.

This change also removes the logic for jumping gaps at the beginning
of the timeline.  This is handled by the more general gap jumping
logic and works cross-browser.

Finally, this updates the buffering logic to only count the amount of
content buffered (i.e. ignoring the gaps).  This fixes some bugs where
gaps in the content can result in StreamingEngine buffering forever
since it thinks only a little is buffered.

This includes full implementation of the logic, but this doesn't close
the issue since there aren't any integration tests yet.  Those will
be added next.

Issue #555

Change-Id: Id99eb9fe469e8cf2c7464a3d70c3733791e806e0
2017-04-17 18:15:23 +00:00
Sandra Lokshina 0b12937520 Replace content type strings with constansts.
Change-Id: I4fda583915766b40ee7a5c7451d037077d9f2582
2017-03-08 21:41:59 +00:00
Jacob Trimble 43380239ba Call abort() before setting timestampOffset.
When appending MPEG2-TS segments, we seem to always enter a
PARSING_MEDIA_SEGMENT state in the SourceBuffer.  While we are in this
state we can't change the timestampOffset.  This means that we can't
change Periods or adapt to a different resolution.

To fix this, we call abort() before setting the timestampOffset to
reset the state.  Because abort() also resets the appendWindowEnd,
this merges the two operations so we set timestampOffset and
appendWindowEnd at the same time (since we do already).

Issue #279

Change-Id: Icd893ded9e3137179f262ba10e55e41d06ec5a77
2017-02-17 11:51:06 -08:00
Joey Parrish 1b993ac22a Fix MediaSourceEngine test failures on Chromecast
MediaSourceEngine integration tests were failing on Chromecast due to
pollution of global state by CastUtils tests (video element not
removed, MediaSource object leaked).  By fixing the clean-up in the
CastUtils unit tests, MediaSourceEngine integration tests are now
passing on Chromecast.

This also makes the video clean-up in MediaSource and StreamingEngine
integration tests consistent with the way the library cleans up video
elements in Player.

Change-Id: Id49d40ba1970040c0dd1fc342f2657fc3f5a24b8
2017-01-11 13:48:06 -08:00
Joey Parrish ec2b1cf471 Clean up stream generation in tests
- Factor segment metadata out of MediaSourceEngine integration tests
   - Use TestScheme metadata and generators instead
 - Factor segment metadata out of StreamingEngine integration tests
   - Use TestScheme metadata, but own generators
 - Remove unnecessary assertion from DashVodStreamGenerator
 - Rename TestScheme "codec" member to "codecs" for consistency
 - Correct segment durations
   - Avoids audio segment overlap, which is not well-supported

Closes #623

Change-Id: I9de7554bf854d8d29916d7dc8247ed423fb6af28
2016-12-05 14:14:47 -08:00
Joey Parrish d0908fe743 Raise the async test timeout to 120s
All tests now have the same timeout value.  This should simplify the
process of addressing timeouts on Safari.

Change-Id: I3b455bd639758007ec8b2b86ef236c56e919c15a
2016-08-11 10:54:49 -07:00
Andy Hochhaus b7fc078139 Update to compiler v20160713 2016-07-26 10:16:57 -07:00
Jacob Trimble 28aac020a6 Add test networking scheme.
This allows integration tests to test Player and offline with "real"
manifests and segments that are generated using ManifestGenerator and
StreamGenerator.  The networking scheme can also be used with an
unmodified Player.

b/29883614

Change-Id: I77aa5385ecaaac43ba713687befa2f064654375a
2016-07-12 21:52:36 +00:00
Joey Parrish 2585464faa Extend test timeouts to reduce flakiness
Based on several rounds of experiments, the timing on these tests was
determined to be too strict.  Extending delays and timeouts on these
tests reduces flakiness across browsers and platforms.

Change-Id: Ie36c86f3afcb615991454d098e690199ca063f96
2016-07-09 00:00:41 +00:00
Joey Parrish 422f5aa5cb Correct usage of jasmine's toBeCloseTo matcher
The second argument is meant to be the number of decimal places to
which the value must match, not the maximum difference.  So using
"0.1 decimal places" meant the maximum difference was actually 1.25.
You must pass "1" to get a maximum difference of "0.1".

This also adjusts some of the expectations to fix affected tests.

Change-Id: Ibc1223297011063e3e4f3fff0ba64fde06292128
2016-07-07 17:52:46 +00:00
Leandro Moreira a8c44da4b1 restructures test files 2016-07-01 09:53:30 -03:00