Commit Graph

193 Commits

Author SHA1 Message Date
Aaron Vaage 7426cfa1f0 Resolve SessionDeleter Compiler Warning
It looks like the lack of a constructor is at the root of the compiler
warnings when you try to alias a class.

To stop the error, I have made a small modification to the session
deleter class so that it could have a constructor.

Change-Id: Iad4614d80dc317b20f01930019096fb388b74ed9
2018-12-13 19:12:42 +00:00
Aaron Vaage 1b90e0f4c1 Integrate Deprecation Tool With Library
This integrates the deprecation tool with our library and updates
all the deprecated warnings to use our new tool.

As some features needed to be removed in 2.5, this change removes them
since their deprecation checks would make us fail.

Change-Id: I28310bbe9df6839719f4763a96026d5968bdcea6
2018-12-12 00:26:50 +00:00
Joey Parrish b2e93020a6 Fix async-related errors ahead of a new compiler release
Change-Id: I6859f4d921c74a70c2d21bf057d8f5ee747ee046
2018-11-15 18:26:38 +00:00
Joey Parrish 64e6e9508d Add missing private annotations
Caught by a newer compiler/linter that we have not been able to fully
adopt yet.

Change-Id: If25c7132f33d5544533542283c42a5ac7f39a552
2018-11-09 14:28:49 -08: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
Aaron Vaage 32b34479f5 Create Text Segment References
We were failing to download text. It appears we were not creating
the segment references for the text streams. This adds the text
streams to the set of streams that we are looking to download.

BUG: b/118437010
Change-Id: Ie4367e61519b5856cb63cacf8621453b677cf94b
(cherry picked from commit ec837b91193c07e8ba15300fb56f5b4010bbae7a)
2018-10-31 15:54:37 +00:00
Gi Gi 517730970d Set server certificate before Store and Delete (#1639)
Call setServerCertificate before store and
delete operations, when serverCertificate
exists.
In demo application, request and
configure certificate when certificateUri
is given in asset.

Fixes #1623
2018-10-24 13:56:58 -07:00
Aaron Vaage 79719ee02c Resolve TODO in Storage
There was a TODO I left in storage about using sets when finally
adopted them, so I am happy to say I got to resolve it to day.

The change here is that instead of using a object as a map to track
which ids we have seen, we can now use sets.

Change-Id: I9288c3e48c67d2f8cfeda70883ffb683bf735cae
2018-10-23 18:31:01 -07:00
Jacob Trimble f78471eb7c Misc Storage and demo fixes.
- Fix assertion about deprecated configuration path.
- Fix running Storage.configure() with drm configs.
- Fix null reference error when certain errors happen when storing.

Change-Id: I5a7b5178ed01febcc11f323bf6dcdf4eadaaa241
2018-10-04 15:55:58 +00: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
Jacob Trimble 65e9c36f6c Add database for storing session IDs.
This new database will store EME session IDs that need to be removed
at a later time.  For example, this can happen if we fail to remove
the session when deleting content.

Issue #1326

Change-Id: I808103535d93c9070e13e30b8cd939fea757cafe
2018-09-27 17:49:27 +00:00
Aaron Vaage f8b707aaeb Use Sets For Uniqueness
Update all our code to use |Set| to handle storing and testing
unique values.

Change-Id: Id809d4d84e4779ae19be58eca96983750c3f3a81
2018-09-14 22:03:04 +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 bf6fcf0222 Add a wrapper around IDB cursors.
Change-Id: Iaf97caefde0264e6efdbd61aa9a048921243d98f
2018-09-07 10:25:14 -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 0310c78b92 Isolate Util Method To Be Near Usage
There was a stream utilty was that only be used in one class
(another utility class). The method was to get tracks, but it
sat along side other methods that look similar but were different
in very small ways.

This change moves that function to be in the same class as where
it is used so that it will be less distracting from the other
getTrack methods.

Change-Id: I21737b6b1341c06b41e6016e24b2b20ce5d40e77
2018-08-30 19:39:37 -07:00
Aaron Vaage f2c73721fd Correct Error Not Thrown in Storage
When moving the manifest validation code, an error that was
meant for no periods got moved to no variants.

Change-Id: I2049e527baf247a7ec0281bcb443da6a2f20710b
2018-08-28 13:26:41 -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
Jacob Trimble 79fc9e4596 Fix storage configuration bug.
Fixes: 113277647
Change-Id: Idc61402b205504dff6381751d6cb4aa05e987cbc
2018-08-27 14:57:36 -07:00
Joey Parrish f6fd524bcf Add newly missing @private annotations
Issue #1553

Change-Id: I72cd2ab5b133d33b5f2f58747b071d008539232d
2018-08-24 16:40:49 +00:00
Aaron Vaage 7cadde0d61 Filter Manifest Before Downloading
I was looking at some of the storage code and got confused with
when and where we were filtering the manifest. After spending
a lot of time trying to map it all out, I found that it would be
easier to understand if we:
  1. Did all the filtering at one time.
  2. Did all the filtering before trying to download anything.

Change-Id: I377fbeaa1873ae3fccff438ffcb10b3fb53f48d9
2018-08-23 11:29:21 -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
Joey Parrish 6577a6e2ce Fix lingering references to shakaExtern
We renamed the extern namespace, but these references were in comments
that were not examined by the compiler.

Change-Id: If232953f678fba703c5355445f4f0cf180b46749
2018-08-21 10:42:10 -07: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
Joey Parrish ca3119dfba Correct segment timestamps in PresentationTimeline
Before, segment timestamps were used in PresentationTimeline without
regard for the period start.  This means they were not truly relative
to the presentation, but to the period.

The "isFirstPeriod" argument was also broken.  It was meant to be true
for segments from the first period *ever*, but was passed true for the
first period *in the latest manifest update*.  So data calculated from
that was bogus for live streams.

Now, notifySegments() is supplied with a period start time, so that
segment references can be combined with the period start to give
presentation timestamps.  This fixes a major issue with the original
fix for #999.

Closes #999

Change-Id: Id0fe450f3ce4f90a2387d7103c75eb88f0c69c72
2018-08-20 19:10:02 +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 bf8bb0ac74 Change Storage To Use Destroyer
This changes Storage to use the destroyer object to manage
clean-up. This will later be used to change how we destroy
storage depending on how it was initialized.

Issue #1297

Change-Id: I7e8c4f959a6764859504b0259bd5e815e5fd3dc8
2018-08-14 00:56:28 +00:00
Joey Parrish bb646befca Fix issues found by newer compilers and linters
Some of these issues were found by the Closure Compiler linter,
which we are not currently using here.  I will try to re-enable it
in a follow-up change.

Change-Id: Ie6e75f2b5a1e0f888c3dfbc78ed9cf254d2738bb
2018-08-09 12:22:34 -07: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 34fe983ea0 Stop using Player inside Storage
We store the references to player's networking engine and
configuration in Storage, so there is no reason to call player
anymore. This change removes those lingering calls.

Issue #1297

Change-Id: I3486ffcb60cd80fd765259d690091cc3267bb8ba
2018-08-08 16:01:29 +00:00
Aaron Vaage 05b071d7fa Add Stream Utils for Common Practices
Added two new stream utils for practices that pop up multiple
times in our code base.

  1. getAllVariants - Get all the variants in a manifest.
  2. getVariantStreams - Get all the streams (audio and/or video) back
                         as an array.

Change-Id: I87fa4959e4a17dcfff20d5aa0678e6dc346d413e
2018-08-06 16:52:33 +00:00
Aaron Vaage 6cefea5a37 Remove cast in deleteAll
There was a cast in Storage.deleteAll that really should not
have been there. This changes it to use an assert to ensure
that the case is exposed if done wrong.

Issue #1297

Change-Id: I21f9737c0fc79c2b4324a7385a2814f94f40f884
2018-08-02 00:08:32 +00:00
Aaron Vaage 36ecbb1912 Share Networking Engine From Storage
Allow users to get access to the networking engine that storage
instances are using.

This is part of allowing storage to be used without a player instance
as it will allow users to configure the networking engine when they
create a storage instance without a player instance.

The code still assumes that Storage should never destroy the networking
engine. This is something that will need to change when storage can
be initialized without player.

Issue #1297

Change-Id: If8d1642259e0cf24cb43f2ca7936227e8d939260
2018-08-01 16:13:39 -07: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 bbb7a83563 Add mime type option to Player.load
Added an option for the mime type to be passed to the load function.
Going forward this will replace the option to pass in a manifest
parser factory.

This is to help with issue #816 as passing in the mime type will be
one way for the player to know if it should use src= over MSE.

Issue #816

Change-Id: Ic356bb9f52c3977620debc8d4a09b7115a81d516
2018-07-31 21:15:44 +00:00
Aaron Vaage 44bfce73fd Limit Scope of applyRestrictions
When reading through player I saw we did something like:
let variants = period.variants;
...
shaka.util.StreamUtils.applyRestrictions(period, ...);
...
doSomething(variants);

This causes some confusion as it was not clear if |variants| would
still be valid to use (i.e. could applyRestrictions) change the
reference in period like we do in some other filter functions.

So to help make it clear that it doesn't, I have changed
applyRestrictions to accept a variant array rather than the period.

Change-Id: I6dc080a1b1e563e5dd2789bd00fb0cfeb7de41de
2018-07-19 20:33:32 +00:00
Aaron Vaage 48019c9dc8 Make Storage Only Accept Non-Null Player
Make sure that only non-null player instances can be given to
storage.

Change-Id: Ib0a6f2992eb18f2ae4360408445274c3d63d0063
2018-07-17 22:53:47 +00:00
Aaron Vaage e9f6e58d89 Track open operations in |shaka.offline.Storage|
Track all open operations in |shaka.offline.Stroage| so that we
can wait on them in |shaka.offline.Storage.Destroy|.

Change-Id: I648cb18545f9f1e0745ffddd70baac8fc316b0cb
2018-07-16 23:45:25 +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
Jacob Trimble 759eef9685 Change goo.gl links to bit.ly.
https://goo.gl is being turned-down, so we can't use it for new URLS.
So we have consistent short links, this converts them to be
https://bit.ly.

Change-Id: I07a86cba807b67157664893341f648023918d0de
2018-06-22 20:20:00 +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
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
Joey Parrish a915af11aa Add missing @private annotations and goog.requires
Change-Id: Ieacf51e9c82eb1c5fa72d4d8594055a785e829ef
2018-05-10 15:33:11 -07: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