Commit Graph

280 Commits

Author SHA1 Message Date
Aaron Vaage 410789e2be Correct Return Type That Closure Missed
It appears that closure did not notice that a return type
was not consistent. This corrects the return type to match
what the download method in download manager actually
returns.

Issue #1248

Change-Id: I796e31d9e7ad1d812bd53a55f5f1c745ac0b187c
2018-04-11 18:34:18 +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 8985f5cfa5 Remove non-nullable annotations on function
Function is implicitly non-nullable.

Change-Id: I6a86f20bcb3e9cf7886b8f352eee377968e2460f
2018-04-11 08:23:07 -07: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
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
Aaron Vaage 2ba27a681b Moved Storage Out of Download Manager
Move the use of storage engine out of download manager and back into
storage. Storage creates and manages the life of storage engine, so
it is easier for it to handle all storage functions.

Now, the callback that is given to download manager is used to pass
the downloaded array buffer back to storage so that it can be saved
into storage engine.

This moves all uses of storage engine into storage which will make it
easier to replace with Storage Muxer.

Issue #1248

Change-Id: I555788478af09d1d79c3db7534431e1d9daf4e20
2018-04-09 20:42:45 +00:00
Aaron Vaage 316b3ea573 Remove Unused Optional Method Parameter
Because we changed how we collect the streams before downloading we
no longer used the variant id parameter. This change removes the
parameter.

Issue: #1248
Change-Id: Iab4323c7b358ed83812b2ff36e9632022e65f88a
2018-04-09 18:14:35 +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
Aaron Vaage 612d248d4c Clean-up Downloading Groups
Went through the download code and tried to make it easier to read
and understand.

Issue #1248

Change-Id: I74316d3337248f0d16f2fb6cc1734e1e57739966
2018-04-09 18:13:16 +00:00
Aaron Vaage 0a3f4d6566 Group Downloads By Stream
Group downloads by stream id so that download manager does not
need to know about the stream types.

Issue: #1248
Change-Id: Id61df4e67a419ee085dfd96a863bb56f01a4b732
2018-04-09 18:13:11 +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 21f032a1cd Clean-up Similar Track Check Loops
Changed the loops used to check for similar tracks to be simpler. Yes,
there are some double checks, but over all it is easier to read. Since
this code is ran very rarely, the minor redundant checks should not be
a problem to the user.

Issue #1248

Change-Id: I6589dda233e94defb5729934ee859b78e3af193f
2018-04-05 21:51:29 +00:00
Aaron Vaage b27b649f6f Create IDestroyable.with
Created a static method that will handle destroying a destroyable
object when you are done with it.

Issue #1248

Change-Id: I4df0569f5f5e00002600702cf24caf1ed2da7c5b
2018-04-05 14:05:29 -07:00
Aaron Vaage 8c988fa4bc Wrap Getting Network Engine in Storage
Every time we would get network engine in storage we would need
to assert that it was not null. To make this easier (especially)
with promises, we add a function that will only return an non-null
networking engine.

Issue #1248

Change-Id: Iba415426ea42007addbb26c7a6b99a54a5064440
2018-04-05 13:32:39 -07:00
Aaron Vaage 10e161828f Limit Variable Scope in Storage
Removed the class-wide instances of drm engine and manifest
that were in storage to make it easier to understand where
they come from.

Issue: #1248

Change-Id: Iee0932b36a0a66eefd1995a2318981708e588f35
2018-03-29 17:43:18 +00:00
Aaron Vaage cec4a5c12b Isolate Storage Remove Function
Isolate the use of storage engine in the remove function so that it should
be easier to replace it with the new storage system.

Change-Id: Ia764b680026018dfcb10f8bebc98e4d7435793d8
2018-03-28 17:17:55 -07:00
Aaron Vaage c1591314fb Isolate Storage List Command
To make it easier to update storage.js to use the storage muxers
each command is going to be isolated so that the dependency of
each command can be clearly established.

Change-Id: Iedba4bd0cefa96ca2e69db1fa83d3ba074a3fc29
2018-03-28 20:57:44 +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 870a76f146 Change Storage Muxer to Express Paths as Tuple
Instead of merging the mechanism and cell names together
to make the path, use a class to hold them separately. This
will make it easier to work with the OfflineUri.

Change-Id: Ib0065e9d9a8553a90a7b4778e118dd3ca6435f32
2018-03-27 21:19:33 +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
Theodore Abshire f58afd21da Typo fixes and rewording in comments, part 5
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: Ibcaf21382bd78b91e589122983dd14e001bfdad5
2018-03-21 17:25:13 +00:00
Joey Parrish f0a3dbe1e2 Update architecture diagrams
This updates the existing diagrams and adds new ones for cast and
offline.  The offline diagrams will need to be updated again after
we resolve #1248.

Closes #1197

Change-Id: I6b6b1fac732b4997c579f58c7f12f0f84f202380
2018-03-15 08:07:22 +00:00
Aaron Vaage 85bdf8ca23 Fix Errors in IndexedDB Code
Fixed an issue where an update call the IndexedDB was not replacing
the correct value because the key was getting changed to a string.

IndexedDB will count a missing key as a success, so check that the
value is undefined.

Issue: #1248
Change-Id: Icdd6ae263374c655170c6470df85c656b8bd3ba2
2018-03-14 00:06:04 +00:00
Aaron Vaage af578ac627 Define Storage Muxer
Storage Muxer is responsible for finding the correct cell for a
given operations. For example, when writing new content, you need
a cell that supports add-operations, the muxer will find one.

Issue: #1248
Change-Id: Ifd9fd32f9487c0b9bc011ae8b004eec4ee75f7c4
2018-03-07 22:33:13 +00:00
Aaron Vaage b92d8f31e7 IndexedDB Storage Cell for IDB Version 2 and 3
Since the database schemes for idb versions 2 and 3 used the same
data types (shaka offline version 2) this storage cell can be used
for both. The only difference is that idb version 2 has a fixed
key space.

Issue: #1248

Change-Id: Iac5cb1d57f93fdb81729b59d67d6736e29c9968c
2018-03-06 21:47:37 +00:00
Aaron Vaage 2bdb032e4c Created Base Classes for Working With IndexDB
Created base classes that will be used when working with indexeddb.
These classes are used to manage connections and transaction is a
more promise-friendly way.

Issue: #1248
Change-Id: Iafd001072bee8572f41af7069532f3a1ccd39fbc
2018-03-06 12:40:40 -08:00
Aaron Vaage d8a4b201fb Implement Memory Storage System
Created a memory storage system that holds all data in main memory. This
system will be used in tests.

Needed to update the eslint rules to allow us to have an instance-level
method that does not use |this|.

Issue: #1248
Change-Id: If1ebbec62bfdae57ee06df9fdef9955b30579d52
2018-03-05 17:04:27 -08: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
Chris Fillmore 4ac1a40578 Provide RequestType in error data from HttpPlugin. (#1254)
Closes #1253
2018-02-12 10:01:58 -08:00
Joey Parrish d4b1eb0ca6 Handle UNSUPPORTED_UPGRADE_REQUEST in the demo app
Issue #1230
Issue #1248

Change-Id: Ia3942d8f6fc1b6c5e0166f86aa6620625f75d0db
2018-02-01 08:36:05 -08:00
Jacob Trimble 807dcbc2cd Fix deleting offline licenses in demo app.
Closes #1229

Change-Id: I9886561d242748ebc6728d447f752db798d3df29
2018-01-30 17:37:40 +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 bd2b163743 Update DBEngine to Use Some ES6
Updated all the 'var' to 'let' and 'const'. Replaced uses of bind with
ES6 inline functions.

Change-Id: I0427b972c56ac304417d3129cc9d137610cb5b6b
2018-01-26 11:12:03 -08: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 c168ee86ad Expose Delete Storage API
Expose a function through Storage to allow developers to delete the
database that backs storage.

Change-Id: Icb20b6c43966a299d8903b2d14f33666f672bd15
2018-01-26 10:59:28 -08:00
Aaron Vaage 965dc8e100 Removed DBUpgrade
This removed all of DBUpgrade (lib and test) as it was not accomplishing
its requirements.

Now instead, if DBEngine detects that there needs to be an upgrade, it will
abort the upgrade and message the app with |UNSUPPORTED_UPGRADE_REQUEST|.

Change-Id: If65bc013b0482c9b0c6e71e644e9132584984414
2018-01-26 10:59:25 -08:00
Aaron Vaage 750964e62f Print detailed indexeddb error
When there is an indexeddb error, print the error to log error so that
the extra bits of information are exposed.

Change-Id: Ie67fa025946534f4c84c935ce55e169d3ecf8c0f
2018-01-18 23:46:40 +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
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 a17e904261 Add upgrade guide for v2.2 => v2.3
Issue #1183

Change-Id: Ib933603dd5ea35e1aa2c600970ce71a9a0a37b2e
2017-12-20 03:02:52 +00:00
Joey Parrish cbdbfbdec7 Update changelog for v2.3
Issue #1183

Change-Id: Ia25fba9e5f8149c12f55a8486ca3eb6bcd4131ea
2017-12-20 03:02:52 +00:00
Aaron Vaage 1cf0a38843 Support Upgrading from Version 1 to Version 2
Added a DB Upgrade path for converting content from version 1
to the version 2 format.

Issue #1047

Change-Id: Id8dc626d8289b08ca300c40b137173c0c6ec9d35
2017-12-18 19:04:04 +00:00
Aaron Vaage 967f339934 Mark Version 2 of DB Engine
externs/shaka/offline.js now represents the data types for Shaka Player
Offline V2. All offline shaka player code uses the new version and all
V1 and transitional code has been removed.

Issue #1047

Change-Id: Ia43f8d8d11426e823629e5fcd27c4e1e0ce400d3
2017-12-16 00:11:04 +00:00