Commit Graph

54 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 4eefaa44cb Correct type info in tests
In many places in the tests, we used "Object" or "*" or just no type
at all for various fakes.  These were all flagged by the new Closure
Compiler version we are adopting.

In some other places, we mixed up similar types or had the wrong
nullability on a type.

In still others, types were missing fields.

These issues were caught by a compiler upgrade.

Issue #2528

Change-Id: I324e0b28f7e30a4102aa26ec2c9901fa9732211b
2020-04-30 16:00:17 +00:00
Joey Parrish df213d8c1d Fix usage of Storage API in tests
We recently updated the Storage API to return AbortableOperation
instead of Promise.  These tests did not get updated at that time.
The runtime backward compatibility kept the tests from failing.

This was caught by a compiler upgrade.

Issue #2528

Change-Id: I05f75a5e4443b111c63d7969950777db78133626
2020-04-29 21:08:40 +00: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
Joey Parrish 28a5c421f3 Fix DRM test failures introduced by removal of deprecated features
Change-Id: Ic667a0487fa08460b9c3fb7a18176f2fcb068cc3
2020-02-25 15:20:30 -08: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
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
Joey Parrish 3b0ceafdca Deflake offline and player integration tests
This makes some of our integration tests more robust by using
integration test utilities for observing playback status.

b/128923302

Change-Id: Iae5efe55308660bfe1cde9a7f735ee54dbc0b526
2019-04-17 15:26:26 -07:00
Sandra Lokshina 493d459c47 Add a DOM util.
Change-Id: Ia0941868f20dbb42fa0fe02a639015ac244a65ed
2019-04-05 12:01:59 -07:00
Aaron Vaage 4e910bc5ab Poll Current Time In Offline Tests
Before we would just wait X seconds and hope that playback would reach a
certain point. In some cases this would mean waiting 10 seconds.

In this change, those tests are changed to poll the media element's
current time. To allow context-specific timeouts, we include a timeout
time with each call. This equates to "we expect to see playback pass
time=X within Y real seconds".

Change-Id: I8293c7dd5fdccf2c1d910fb48e037c93a25e3199
2019-04-01 22:10:29 +00:00
Aaron Vaage 0298bc1137 Remove Unused Access Suppression Tag
There was an access suppression tag in the offline tests, however there
was not accesses to suppress. Removing the tag did not yield any
compiler errors or runtime errors.

Change-Id: I4a6d4a5611791427d752b1fd2157e9aa7ae35ec1
2019-04-01 16:19:31 +00:00
Joey Parrish fc52f263be Work around offline integration test failure
This adds a workaround for a Chrome bug so that the test can be
unquarantined.

Change-Id: I3b076af346db008f3b59e7897c79e78f29fc72df
2018-12-13 09:50:15 -08:00
Joey Parrish 618864e2fe Quarantine failing offline tests
Offline tests are failing due to some combination of 4 related Chrome
bugs:
 - http://crbug.com/690583
 - http://crbug.com/887535
 - http://crbug.com/887635
 - http://crbug.com/883895

Closes b/120553775

Change-Id: I0b75eb64aa924a01fd5bb0afb0f858a68eaff501
2018-12-13 17:50:03 +00:00
Joey Parrish 2d9299e513 Fix erasure of the database
In cases of corruption or version mismatch, we must be able to delete
the database without loading anything from it.  This comes up in
testing when you run an older version of Shaka Player after a newer
one has created the database.

Our ability to erase the database in these cases was lost when we
fixed #1277.  This reverts that change and changes the contract of the
storage classes to ensure that we will always be able to erase the
database, no matter what.

Change-Id: Iccfbe1fa2ca880877e4743e5ca6bd42cba44abe0
2018-11-09 11:18:14 -08:00
Aaron Vaage f3f2c757fc Remove Licenses with Storage delete all
Before, when clearing storage with Storage.deleteAll, offline
licenses were not released. Now before erasing storage, all
sessions ids are collected and requested to be removed.

Closes #1277

Change-Id: Ib88a14f5132d3b2a34bd339cc45f121792b65ebc
2018-05-14 19:02:18 +00:00
Aaron Vaage 8040f78883 Integrate StorageMuxer and Player
This CL replaces the old storage system with the storage muxer system.
In addition to replacing the old system, this CL removes all the
code that was only used by the old system.

As of this change Storage Muxer support shaka player's V1, V2, and V2
indexeddb schemes and exposes a plug-in system for other offline storage
components.

Issue #1248
Change-Id: I1a4914477ad8db29fd0e7ad7de2f149b6497f67e
2018-05-09 18:41:21 +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
Aaron Vaage 33547d071c Stubbing-in Mechanism & Cell Fields in Offline Uri
Adding "mechanism" and "cell" fields to offline uri. But since
they are not used anywhere, this change sets them to dummy values
so that all the constructors could be updated.

Moved the manifest reconstruction code into a instance class as
the mechanism and cell for the asset is needed in order to create
all the segment uris.

Change-Id: I2b5738805b17c4aa33d39b3166fddf1528aed489
2018-03-27 21:19:47 +00:00
Aaron Vaage 6ae49efc96 Move Offline Uri Functions in Class
The offline uri is going to soon contain more information (routing
information used by the storage muxer) so this change makes offline
uri a class so that all components can be accessed.

Change-Id: I5137f278e0dab059191d450876cab42745e4ed0b
2018-03-26 19:17:35 +00:00
Jacob Trimble 064089152b Remove spacing around object definitions.
This is an automated fix to be inline with Google style guides, this
was created with eslint's --fix option.

Change-Id: I860eecbc8152603e730aa17a1393f16d26b3b6fc
2018-02-21 13:35:00 -08:00
Jacob Trimble 4004bd42fd Convert 'var' to 'let'/'const' (7 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: Ib137fbfde50f1330c74c040fc062aa8e2c6d1e57
2018-02-15 21:16:33 +00:00
Joey Parrish a63352c8f3 [ES6] Enable stricter checks in eslint
This digests and organizes many of the automatic settings in eslint,
and changes several of them to be more strict.  This also fixes the
following errors:
  - array-callback-return
  - no-catch-shadow
  - no-multi-spaces
  - no-new
  - no-throw-literal
  - no-useless-call
  - no-useless-concat
  - no-useless-return

Several checks have been organized into a group of checks we should
use, but need more time to implement and fix.  Some other checks have
been delegated to the Closure compiler, which can more precisely
whitelist exceptions.

Issue #1157

Change-Id: I8fe4966959e08050f8159e6a1fee161e7d71177e
2018-01-17 21:56:41 +00:00
Aaron Vaage 624ab03e48 Stop Edge Failure During Upgrade
Edge does not like it when we delete the old stores in the
database when upgrading. Since this can't seem to be worked
around, instead of delete the store, just clear it.

This will leave two empty stores in the database, but since
they will be empty, they should not waste any space.

Change-Id: I11d5b8b105b34277d92e9c1f7f83b36fc6171960
2017-12-21 21:11:36 +00:00
Joey Parrish 4ce963415e Fix offline storage with temporary license issues
This change:
 - Fixes the use of temporary licenses with manifests without init data
 - Re-enables an integration test which was accidentally disabled
 - Makes that test use a manifest without init data, to cover #1159
 - Makes the test less flaky
 - Reduces the minBufferTime of offline manifests, which both speeds
   up load of offline content and makes the test faster / less flaky

Closes #1159

Change-Id: I3342e5112564a607f16f5d10c457a032443c57cb
2017-12-14 21:36:08 +00:00
Aaron Vaage 46685fbd15 Moving Offline Uri
Moving offline uri code to avoid an upcoming circular dependency in
the upgrade code.

Change-Id: I952386f17c6d4e7806d97e2f540887b915f68de7
2017-12-14 00:00:23 +00:00
Aaron Vaage 3399292d49 Changed Storage Remove API
Changed the storage remove API to use the offline uri instead of
the stored content as that is all that is needed to remove the
content.

Updated the demo app to remove using the Uri and not stored content.

Change-Id: I72a1049838759452eb16c78c8f1f7f4170e4e841
2017-12-12 22:12:56 +00:00
Aaron Vaage 8f45f7939d Changed Stored Content to not always need an offline uri
Before, stored content always needed an offline uri. As the id
will soon not be available before saving to storage, stored
content needed a way to represent content that was being
downloaded.

This change allows the offline uri to be null to represent content
that is being downloaded. It also allowed stored content to be
created from a Manifest (for content to be downloaded) and to be
created from a ManfiestDB (for content already downloaded).

Change-Id: I3039069995f0b061112ed0c636a53ceef5673389
2017-12-11 23:21:12 +00:00
Joey Parrish 8c80b6cefa Wait for close(), but timeout after 1s
An improved workaround for https://crbug.com/690583 and #1093, on top
of PR #1168.

If we don't wait at all, we end up trying to use the same session ID
too quickly, which causes a playback failure.

Change-Id: I8c9d1a0f09432054b862e033b80b0c2f47739c74
2017-12-05 16:47:54 -08:00
Aaron Vaage 0e43b62f04 Fixed using wrong DBEngine name
The offline integration tests were writing to one DB Engine instance
but reading from another. This meant that it could never find what it
wrote.

Change-Id: I1d641e18401e27d906d437c70d7691f9ab448ff3
2017-12-06 00:11:20 +00:00
Aaron Vaage b98ce99f08 Add Type Structure to Storage Engine
Changed the Storage Engine interface to know about the types that it
is expected to store. This allow the implementation to do more internally
as the scope of the object has been limited.

Change-Id: I388e2bde5e7e3f99e8b28bd16e08a8f6d5fc6453
2017-12-04 22:41:23 +00:00
Aaron Vaage ee006d4523 Consolidate Mocking IStorageEngine In Tests
To make it easier (and more consistent) to mock the default storage
engine in our tests, this change introduces StorageEngineFactory and
MockStorageEngineFactory.

StorageEngineFactory is now used to create instances of IStorageEngine
in the library. MockStorageEngineFactory makes it easy to override
specific parts of StorageEngineFactory.

Change-Id: Icd28b7f4913add1318a24f436e54b3c694312d2c
2017-11-08 16:28:16 -08:00
Aaron Vaage 07e81f7bc9 Move all uri parsing and creation to Scheme
Moved all the logic that is used to construct and parse uris for
manifests and segments into the offline scheme file.

Change-Id: Ie4dbd12256667296e3c67ed0ecf47f1752dd86eb
2017-10-27 20:08:28 +00:00
Chris Fillmore d1ddd720c2 Publish an event from DrmEngine if the CDM accepts the license. (#1049)
Closes #1035
2017-10-04 15:37:25 -07:00
Jacob Trimble 26bacb1489 Disallow unknown properties (3/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: Ic37437a1ad2305bc50a814cdcc562e74703222ac
2017-07-05 17:47:03 +00:00
Joey Parrish 892d107433 Reorder, clean up, extend times of offline tests
This changes the order of the things tested in the offline tests,
cleans them up a little, adds comments, and extends the playback
time by 5 additional seconds to deflake the tests.

Closes #903

Change-Id: I9c0656882cf31e3f61c67946b7867d3ef25ba953
2017-06-22 20:14:21 +00:00
Joey Parrish 8b54c7b758 Define, document and rename new option for offline
The new isPersistentLicense option was not documented in #878.
This adds docs and renames it to usePersistentLicense.

Closes #873

Change-Id: I59ed32c98660ad7c155392a1708eab98f63131c3
2017-06-21 14:56:05 -07:00
Graham Scragg 59fe4e5d40 Support for offline data with a temporary license (#878)
Based on app configuration, we could store protected content offline
without a persistent license.  The offline content would then require
a network connection, but only briefly for licensing.  This makes
sense in a lot of commuter or airplane WiFi scenarios.

Closes #873
2017-06-21 14:44:02 -07:00
Jacob Trimble 575f2ad109 Add an indicator for critical errors.
This adds a severity field to Error objects.  This can be used to
detect whether an error is recoverable.  All the same errors are still
reported so the field can be ignored.

There are two possible values:
* RECOVERABLE means that the Player will try to recover from the error
* CRITICAL means the Player will be unable to continue and must call
  load() again

Closes #564

Change-Id: Ie2c5468340c13e7a288b99690ab65b7ecc0a6b29
2017-04-04 23:57:59 +00:00
Jacob Trimble b4d0fa4901 Expose license expiration times through Player.
This adds a method on Player to get the license expiration times for
the current EME sessions.  This also adds the expiration times to the
stored content structure for offline content.  This will update the
stored expiration while playing content (e.g. license duration changes
when playback starts).

Closes #727

Change-Id: I18770a79413423695bbb2ed5f31f6b19038a33d2
2017-04-03 18:25:43 +00:00
Joey Parrish 0c4f6258b3 Treat DRM license tests separately
These tests will no longer be lumped into the same group as "external"
asset tests.  This will allow us more control over test coverage in
different scenarios in our lab.

Change-Id: I0b0f2ae5ed6e74fdf87ad4ecf94ce41d94763537
2017-03-20 23:38:03 +00:00
Jacob Trimble 7dbc6c4b12 Workaround IndexedDB race on IE/Edge.
This implements the workaround for a race in IndexedDB on IE/Edge.
If we don't get an 'upgradeneeded' event when we expect it, we will
close the connection and retry.

b/35993864

Change-Id: I78d1c18e4798c098167a1a6a184623780002a34f
2017-03-20 21:32:32 +00:00
Joey Parrish 2cbb13fd28 Quarantine failing offline tests on IE/Edge
Change-Id: I8cb77b3e7e1b3b5ddd35e944494c03cd14ff6249
2017-03-06 09:45:23 -08:00
Joey Parrish 84fb9d422e Fix buffering watchdog to match StreamingEngine
StreamingEngine continues to buffer until the amount buffered is
greater than or equal to the goal.  Playhead's watchdog checked that
the amount buffered was strictly greater than the goal, leading to a
race in which we could get stuck buffering forever.

The race was between buffering and the first watchdog timer callback.

If data gets buffered before the first callback fires, the watchdog
will see that bufferedAhead is greater than threshold, and it will
not enter a buffering state.

If the callback fires before anything is buffered, it sees
bufferedAhead == 0 and enters a buffering state.  If the config is
such that bufferingGoal and rebufferingGoal are the same, then
Playhead is stuck in buffering.  StreamingEngine won't buffer more
until something plays, and Playhead won't leave the buffering state
until something more is buffered.

This turned out to be the root cause of failures in one of our
quarantined tests.  While debugging this test, I noticed that
video.playbackRate was 0, which we set while buffering.  This led me
to investigate buffering logic in Playhead, where I noticed that
bufferedAhead was exactly rebufferingGoal in the instances where the
test failed.

In 100 test runs, the test failed 9 times.  No other tests had to be
run to trigger the failure, so this one test was run in a for loop.

Once I understood the cause of the race, I found that I could trigger
the failure in 100 out of 100 tests by changing startWatchdogTimer_()
to onWatchdogTimer_() in the Playhead constructor.  This ensures that
the timer callback fires synchronously, before anything can be
buffered.

With the underlying bug fixed, the test has now been removed from
quarantine.

Change-Id: Ief5c11b2211045a32dc0a9f711b17a4ec1bf55af
2016-11-30 00:34:37 +00:00
Joey Parrish bdd147229a Quarantine tests that are not always passing
This hides 6 tests behind the --quarantined flag.  Without this flag,
these tests will be skipped.  This allows us to get consistent results
from the build bot while we work to fix these tests.

Change-Id: I6cf3921228da1831f71a89cd5802ea48c66752bd
2016-11-23 10:16:30 -08:00
Joey Parrish 298dc431c8 Mark tests external for using license server
Tests that use a remote license server should be behind the --external
flag.  This introduces a new shim that makes it easy to mark tests as
external.  This also lays the groundwork to hide tests behind other
flags.

Change-Id: I035de24e02035e732c515522378247c692e74b7c
2016-11-21 16:40:06 -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