Commit Graph

133 Commits

Author SHA1 Message Date
Joey Parrish 6e14d10d91 Update comments in quarantined offline test
This updates the comments to explain why the test fails, what we are
waiting on from Chrome, and under what conditions it could leave
quarantine.

Change-Id: I1def268ebbc59a4e7be57e46d878061b5b7e2efa
2018-12-13 19:07:51 +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
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
Jacob Trimble fa0e8cf7e4 Allow deferring deleting offline sessions.
If we fail to remove an offline session, don't fail to delete the
content.  Instead, store the session ID so we can remove it at a later
time.

Closes #1326

Change-Id: Id76481ece96bd6541367ccc67d13916a2aa51be2
2018-09-27 17:51:21 +00:00
Aaron Vaage 85b61a3a78 Remove Use of MapUtils.values in shaka/offline
Went through all the class in shaka/offline and removed all uses
of |MapUtils.values|. This required changing many uses of Object
to Map.

Change-Id: I6bd6d37009e7b32ea38e9cbabd64c2d36ffeabbc
2018-09-14 21:41:45 +00: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
Michelle Zhuo 5de57c0725 Revert "Change closed captions to an array"
This reverts commit 59920fa80b.
Issue #1404

Change-Id: I90cf8a274949c15779f0193783076ab687fcb9fb
2018-09-12 13:15:49 -07:00
Jacob Trimble c6fca36dd0 Fix Storage test contamination.
In the Storage unit tests, it should always delete the old data to
ensure it doesn't contaminate other tests.  This also removes the
checks in the beforeEach/afterEach blocks since calling pending()
in those doesn't have the desired effect.

Change-Id: Id345882a7ac1ae0ab99d2785851b7553b49a9d3f
2018-09-06 10:47:31 -07:00
Michelle Zhuo 59920fa80b Change closed captions to an array
Changed the ClosedCaptions field in Stream from an object to an
array of ClosedCaption objects, so that it can be iterated through
and accessed easier.

Issue: #1404.
Change-Id: I67980cf4d5b5746785ba29f95718970fe89056f4
2018-08-31 17:10:36 -07:00
Aaron Vaage e25aa0b17b Refactor Ugly Promise Chain in Storage
There was an ugly promise chain in Storage.loadInternal. This change looks
to clean up that promise chain and to use async syntax instead.

Part of the refactoring splits |loadInternal| into two more focused methods
as an effort to make the code easier to understand.

Change-Id: Ica113344c6c4ba1d82b6cee281268e20be1aa411
2018-08-27 16:31:32 -07:00
Aaron Vaage 07fb0642b2 Pass Variants To DrmEngine
Before, we would need to pass a manifest to DrmEngine to initialize
it. This was a problem as we look to support playback via src=.

When looking at how DrmEngine used the manifest, it appears to just be
a simple way to pass in the variants and the offline session ids. By
changing DrmEngine to accept the variants and offline sessions ids, we
can break the association between DrmEngine and Manifest.

Issue #816

Change-Id: Ie0dc82aaec871d7e6e002fe59b3a984449eda8c7
2018-08-23 17:53:57 +00:00
Damien Levin 6117125f2b Emsg not referenced in MPD should be ignored.
Fixes #1548

Change-Id: Ib65957fa43b97e7c8ad61c08923a30de86febb6c
2018-08-22 16:48:02 +00:00
Aaron Vaage 927e68adc1 Split DRM Init Function
There are two intents when we initialize Drm Engine and the meaning
of the parameters are nuances depending on what you are trying
to do.

This change creates two different initializing methods so that
initializing drm engine for the intended purpose can be more
clear.

With this, some internal naming was change to better reflect how
some variables were being used to give them a bit more context.

Change-Id: Id8925eca53a34fe870ba5c973f9f0bb584f6e2d6
2018-08-20 21:41:38 +00:00
Michelle Zhuo 5ef31d4bab Add closedCaptions field to stream
Dash and Hls manifests have tags and values to indicate that the content
may have CEA608/708 closed captions embedded in the video content.
Adding a closedCaptions field in Stream to represent that, and adding
parsing closed captions tag for DASH parser.

Reference:
HLS: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.4.2
DASH: https://dashif.org/wp-content/uploads/2018/04/DASH-IF-IOP-v4.2-clean.pdf

Issue: #1404.

Change-Id: I3c58b6043f7fe294dd642bdada8d2451caec9b55
2018-08-17 21:20:09 +00:00
Aaron Vaage 2191534a23 Initialize Storage Without Player
This change allows storage to be initialized without a player instance.
Since Storage is the same post initialization, the only test being added
is a test that checks that the storage instance was successfully
initialized.

Close #1297

Change-Id: Id2588696eac2a866bba74278322727b1d91f56eb
2018-08-14 00:56:55 +00:00
Aaron Vaage bdaa18aaa5 Support Injecting Delays Networking Engine
Our storage progress tests on Edge were sometimes failing as the promise
resolution order would change. This happened because we queue streams to be
downloaded in parallel.

This changes FakeNetworkingEngine to allow us to register an async function
as a callback for a request. This allowed us to update the test to resolve
network requests in lock step ensuring a deterministic order.

Since the progress test rely on a lot of assumptions, the tests were moved
into their own top-level group and now have their own test manifests.

Change-Id: Id366efccd15d90814ee34ca9a17df7d733ab6d67
2018-08-09 21:17:17 +00:00
Joey Parrish 2aacdd25c9 Expose DASH Representation IDs in new field
The DASH parser will now expose Representation IDs via new fields in
the Stream and Track objects.  The "id" field will continue to be a
unique, auto-generated numerical ID, and will be supplemented by a
nullable string containing whatever was originally in the manifest.

The HLS parser will now expose the NAME attribute in the originalId
field as well.

Bug: 112087288

Change-Id: I6b8107d27780fb97ab18de767f7abdc6c7110fe7
2018-08-09 17:08:42 +00:00
Aaron Vaage 272e6bd922 Merge Offline Config into Player Config
As part of the effort to allow storage to be initialized with or
without a player instance, this change moves the offline config
into the player config and changes storage to share a configuration
object with a player instance.

We opted to share the instance between the two classes because if
storage was initialized with player, the initializer is implying a
relationship between the two objects and therefore configuration
changes should be shared.

Issue #1297

Change-Id: I991365255e63c284fbfcf147cf63c9588dd764ab
2018-07-31 22:07:02 +00:00
Aaron Vaage 546942fc3a Created Destroyer Class To Handler IDestroyable
Created the Destroyer class to handle working with IDestroyable so that
IDestroyable can be a simple interface (no more static methods).

Change-Id: I5afd915b895a4c60d758475a2b879bf0eb0096c9
2018-07-09 22:19:19 +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
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 2e706cd93e Require Non-Null Network Engine in Drm Engine
Require that the networking engine in drm engine's player
interface be non-null.

Change-Id: I5bdb0982ba6734bc1f6035fd00bf07cd04cf5b5c
2018-05-10 21:07:11 +00:00
Aaron Vaage 316e3bfe0a Remove References to "manifest ###"
Removed all references to "manifest 1" and the like in the storage
unit tests. Before we had values called "manifest 1", "manifest 2", etc.
but they were replaced with more meaningful names. However, some comments
did not get updated and some tests did not need to know what kind of
manifest they were.

This change updates the references to either use the correct name, just
say manifest, or generalize the reference of the manifest.

Change-Id: Id95ac1e3d52f7e1dab883c17b8b082b3f8b79c7a
2018-05-10 21:06:52 +00:00
Aaron Vaage 93bb88215b Test Progress Callback For Storage Remove
Added a new test to verify that the progress callback is called when content
is removed from storage.

Issue #1248

Change-Id: I60f1f1ab744d79214685c0060e56f4e21514948c
2018-05-10 19:37:24 +00:00
Aaron Vaage 03fc0bca99 Add Back Progress on Remove
Tracking progress when removing an asset was missing from the new storage
system. This CL adds that support back.

Issue #1248

Change-Id: Iab275cd75af817cfc34ee0888ddeea257b1ead56
2018-05-10 19:37:15 +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
Aaron Vaage 272c4ba89e Create V1 Storage Cell For IndexedDB
Created the V1 storage cell for Shaka Player's original offline
data scheme.

Issue #1248

Change-Id: Ib564ec0670c56ba1b455f198133b118a21fd0a27
2018-04-25 20:18:03 +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 79a6146b5f Revert change to Track and Stream structures
In the initial fix for #1013, we changed the name of the channelsCount
field in both the Track and Stream structures.  This would break
compatibility for applications.  So even though the new name was in
some ways preferable, we must revert the name to avoid more breaking
changes in v2.4.

Issue #1013

Change-Id: Ie8f3d211c42c8046039a3db9f0926c68ad1315d9
2018-04-10 23:45:53 +00:00
Joey Parrish 08af438d32 Track Download Progress With Bandwidth Estimates
Using variant bandwidth to estimate download progress. We use a constant
bandwidth estimate for audio, as most of a variant's bandwidth will be used
by video.

Since we normally don't have bandwidth for text, we use a constant bandwidth
estimate for text so that it can influence progress.

Even through we some times have the actual audio and video bandwidth (DASH)
we choose to use always used the combined amount so that we can have
consistent behaviour between manifest types.

Issue #1248

Change-Id: Ibffe95e2c8d141659855b54949a50ae84c51dded
2018-04-10 17:18:31 +00:00
Aaron Vaage 4a4050d223 Change Download Manager To Take Requests
Changed download manager to take |shakaExtern.Request| as input
instead of |shaka.media.SegmentReference| and |shaka.media.InitSegmentReference|
as it really does not need to know about those types.

Issue #1248

Change-Id: I797c437f4339cf670b5eddad14952b0526b72ea5
2018-04-09 18:13:28 +00:00
Michelle Zhuo a09ae24b85 Add audio channels count configuration
Added a preferred audio channel count to configuration, default set
to 2.
Choose the codec with the largest number of audio channels less than
or equal to the configured number of output channels. If this is not
possible, choose the smallest number of channels.

Closes #1013.
Issue #1071.

Change-Id: I6c6a956e33637cf34bd4bd79af563dc10a595e94
2018-04-06 20:51:28 +00:00
Aaron Vaage d86713cf0d Group Streams Before Downloading
To make it easier to understand, we collect all the streams within a
period using a map. This ensures that we will have a set of streams.

We then download each stream in the map. Since the map is indexed by
stream id, we can easily connect the variants and streams.

Issue #1248

Change-Id: I65ae01733b5d9dbf8b6d73c37f802320fffa03d1
2018-04-06 20:15:52 +00:00
Aaron Vaage 3e56d4ea1e Update Storage Unit Tests
Made some changes in how the unit tests were structured so
that it will be easier to identify problems with changes to
storage.

Issue #1248

Change-Id: I8331f18e9c9e360cf8057737ddfd71c7152a744b
2018-04-04 17:50:36 +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 e6302f5d73 Make Update Expiration Simpler
The only time we ever need to update a manifest value is when
we update the expiration time. To make it easier to support
updating expiration time across different version, only allow
that one value to be updated.

Change-Id: I621ec744019802edc65b059baa7f5cf0c476b0b1
2018-03-26 20:13:15 +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
Aaron Vaage a6c34b64b6 Create Storage Cell Tests for Memory Storage Cell
Made a copy of the storage cell tests for indexeddb but made them
work for the memory storage cell so show that we can expect the
same behavior from them.

This is to give us an extra level of confidence when we use the
memory storage cells in place of the indexeddb storage cells in
our tests.

Issue: #1248
Change-Id: I96eaf57a9d808b4c7e07f97ac2713318a889fc24
2018-03-22 15:46:41 +00:00
Aaron Vaage 798ca28131 Creating Storage Cell Tests
Issue: #1248
Change-Id: I2522ce02e8a9bdb8c6bea9f77adf91393b0265b6
2018-03-22 15:46:36 +00:00
Joey Parrish 3e8a83584d Update the compiler to v20180204
This unblocks conversion of tests to async.  We ran into issues in
compiler version v20171203 which have already been fixed upstream.

We are not, however, updating the linter.  The matching linter version
reports errors about our tests not using goog.require, which we do on
purpose.  We will wait to update the linter until we have resolved
that.

This change also fixes issues discovered by the upgraded compiler:
  1. Missing property definition in playhead_unit
  2. Wrong type name in storage_unit
  3. Wrong type name in FakeManifestParser

Change-Id: I4ba3f43e6a6471e182a69c85cfc619de3380c559
2018-03-21 13:57:46 -07: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 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 cfbbe485e9 Use seek range in Playhead.
Rather than using the availability window, Playhead should use the
seek range to restrict the playhead's position.

Closes #1224

Change-Id: I8612bfafb53bbb214e32aae2d71af52d748a3aee
2018-02-20 23:42:12 +00: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 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
Aaron Vaage 4147e77f05 Add Uris for Downloaded Content To DB Error
When DBEngine aborts because of an upgrade, include a list of the
original uris for all downloaded content.

This will allow apps to re-download the content if they choose to.

Change-Id: Ic2029d935dd8da60c0d502cd0cdbb08b38bbbe76
2018-01-26 11:07:25 -08:00
Aaron Vaage 9e89a90d3c Create DBUpgrade Fail Tests
Create tests to show that DBEngine should not open unless it has
the correct version.

Change-Id: I410e1c5d35a3a7b9e91afdd247f06ffac8d5a86d
2018-01-26 11:05:28 -08:00