Commit Graph

1325 Commits

Author SHA1 Message Date
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
Joey Parrish 6bdbebfa47 Minor cleanup of null checks on non-nullables
Change-Id: I924c267be2b8fc689391ed888f08707e0bd574e0
2018-04-09 18:05:04 +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
Joey Parrish 2e7c25ab67 Export shaka.util.AbortableOperation
This exports shaka.util.AbortableOperation, which plugin writers will
realistically need to update their scheme plugins.

Change-Id: Idfc149f06d22699a78c4d989d331619d5e74f097
2018-04-05 22:03:11 +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
Jacob Trimble f13acd6ac5 Fix ABR selecting key-system restricted streams.
ABR should not select key-system restricted tracks since we can't play
them.  Rather than updating AbrManager to do it, the Player should
just filter out the restricted tracks so a custom AbrManager doesn't
need to worry about it.

Change-Id: I5fa5cdcd9a035136fdccf9bee1a54752a0cacf1f
2018-04-04 14:50:57 -07:00
Joey Parrish 309bd915c0 Rename "getUse" to "using" EmbeddedTextTrack
This name reads a bit more naturally.  Also rewords some of the method
descriptions.

Change-Id: I03a9cb78f88637b6076d64b4c5cd852a69b37f99
2018-04-04 16:51:34 +00:00
Joey Parrish 18b171f5ee Add missing quotes on exported enum
Change-Id: I61a92a389ed0d79e5de8db19f461596f269f1502
2018-04-03 14:58:16 -07:00
Theodore Abshire f32767578a Handle segment tags before playlist tags in HLS
Normally, we expect that only media playlists contain segment tags
(EXT-X-KEY, EXTINF, etc).  We determine if a playlist is a media
playlist by the presence of an appropriate playlist tag (EXT-X-MAP,
EXT-X-PLAYLIST-TYPE, etc).
However, we were checking tags one-by-one, on a single while loop.
This meant that we would reject manifests where a segment tag appears
before a playlist tag, as we did not yet know that the playlist was a
media playlist.

This changes the manifest text parser so that it checks for playlist
type first.

Issue #1382

Change-Id: I1b9f674a58c60ab291d6d004462b0c0cae49631d
2018-03-30 16:30:16 -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
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
Joey Parrish 25971503fa Don't update DASH faster than a device can manage
For slow embedded devices, such as the v1 Chromecast, updating the
DASH manifest takes far too long.  The result is that we can sometimes
repeatedly fall out of the seek range when playing near the left edge
of a live stream.

Until we can dig into and optimize the DASH parser, we will detect
and adapt to slow parsing by updating the manifest less often.

This is done based on how long updating actually takes, and does not
hard-code either the platforms that need this workaround, nor the
frequency of updates they can handle.

Bug: 75276747

Change-Id: I6565192b4ce6935ee8416ea4843fee851f4bd990
2018-03-28 22:48:07 +00:00
Joey Parrish 8bab1964e5 Do not defer seek range corrections during seeking
This fixes a weird edge case where StreamingEngine could get stuck
waiting for Playhead.

If StreamingEngine is playing close to the left edge of a live stream,
a manifest update can evict segments it needs.  This causes
StreamingEngine to wait for segment references.  This condition won't,
change, though, until Playhead seeks back into the seek range.

Playhead wouldn't seek back into the seek range until video.seeking
became false, which couldn't happen until StreamingEngine appended
some content that intersected with video.currentTime.

There seems to be no good reason for Playhead to care about the
video.seeking.

This resolves a startup failure while trying to play live streams at
the left edge of the seek range on slow embedded devices such as the
v1 Chromecast.

Bug: 75276747

Change-Id: Iaa084e8220ace174909d3ad91abe0c1eac00cea9
2018-03-28 22:45:52 +00: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
Joey Parrish 726e013215 Do not buffer audio far ahead of video
No one media type will be streamed far ahead of any other.  The limit
will be the max duration of one segment.

Bug: 75276747  (mitigates)
Closes #964

Change-Id: I0f118e73912b46c987e58d4a5c123acf8412be0b
2018-03-27 22:10:48 +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
Jacob Trimble a10b8a629c Rename segmentAvailabilityStart_ variable.
This is only used for the user-defined seek range for VOD, so the name
is not entirely correct.  This renames the field to make its usage more
clear.

Change-Id: I65a07a07fbfcb79086ed7679004f7e714b2db6f0
2018-03-27 17:36:21 +00:00
Theodore Abshire 8ea237c214 Fixes how the MDAT is read for VTT in mp4 content.
Previously, we would read each individual VTTC and VTTE box in the
MDAT and associate them with durations in the TRUN. This worked for a
lot of content, but if sampleSize is defined in the TRUN, a duration
might refer to multiple VTTC boxes.

This changes the VTT in mp4 reader to parse the MDAT based on the TRUN,
to account for such situations.

For the moment, this only accounts for a single MDAT, and assumes that
the MDAT contains nothing but vttc or vtte boxes, listed in order.

Issue #1266

Change-Id: I56e310d085abdda16e968761ed3b4fd0cc5e24d0
2018-03-27 17:10:48 +00:00
Jacob Trimble 2200d9b292 Fix safe seek window calculations.
This fixes how we determine the seek window for live content.  This
also allows for a slight margin for small seek windows in reposition_
so we don't repeatedly seek with that.

Closes #1331

Change-Id: I70e5e7c134677350d89d42cb0b5abfa784061b9e
2018-03-27 16:52:13 +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
Michelle Zhuo 10e1227051 Fixing Seek after load
Fixing the seek after load not working issue where our customer wants to
start the video from a certain time when playback.
Deleted earlySeekTimer.

Closes #1298.

Change-Id: Ifa293c20c1baf76193948e3b5a7778a2f262222e
2018-03-23 13:34:50 -07: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
Jacob Trimble 938da032b5 Allow non-decimal formats in SegmentTemplate.
Fixes: 75988239
Change-Id: I023a1bd003662c6d651eb870b4aba025dc687327
2018-03-21 22:41:26 +00:00
Theodore Abshire 7c5186332b Typo fixes and rewording in comments, part 7
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: I225f5c7e54adf4cca8512cddae082ba50ed82e4e
2018-03-21 19:45:15 +00:00
Theodore Abshire d46e8fdf92 Typo fixes and rewording in comments, part 6
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: I2bfa4d531a8fcdcf9578e9c181c4534ad7443b7a
2018-03-21 17:59:42 +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
Theodore Abshire 5ae80cc67d Typo fixes and rewording in comments, part 4
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: I5904ec91b96417a9ac5e19cb4f7b07a084f26ac8
2018-03-21 17:25:03 +00:00
Theodore Abshire fca48ea304 Typo fixes and rewording in comments, part 3
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: Ibce58f022b79de5efd5c0f3d5ab40a6042055b3f
2018-03-15 10:12:34 -07:00
Joey Parrish 0c217391c9 Add alwaysStreamText config
This will allow text streaming to work correctly with browser native
controls.

Closes #1332

Change-Id: If11ba67957babad8dea23759aab9004d891aaf6b
2018-03-15 03:49:44 -07: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
Theodore Abshire 9b57779f15 Typo fixes and rewording in comments, part 2
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: I45fb053b6a92f36313cfbc060eeec36cdccc581b
2018-03-14 17:59:30 +00:00
Theodore Abshire dc17969822 Typo fixes and rewording in comments, part 1
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: I048b430e4c0bea2ccb9aec572d5e9ec6b606a87a
2018-03-14 17:59:26 +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
Theodore Abshire e58e8b656b Refactor Player.load using async/await
This breaks Player.load into a number of async sub-methods, which are
called using await.
This should improve readability, and make load somewhat less
intimidating.
This also removes cancelable chain, which after the refactor is no
longer used anywhere in the codebase.

Closes #1336

Change-Id: I85ad22b9c8c6b7f72b27471ddd762763e6591a71
2018-03-13 11:20:52 -07:00
Michelle Zhuo 7568d774df Start playing live stream with certain offset from live edge
To allow playing live stream from certain offset from live edge, we
allow setting the value of opt_startTime parameter for player's load()
function.

Closes #1178.

Change-Id: I23a2375ba8ee5946791ee79714ed017c4e677c9a
2018-03-09 21:42:59 +00:00
Joey Parrish 69ddb9537d Fix CONTENT_UNSUPPORTED_BY_BROWSER error code & docs
Issue #1349

Change-Id: Iea423c3192186d52acfe9990da2137fb0518a3fc
2018-03-09 09:36:45 -08: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
Jacob Trimble 7edb11ba39 Don't repeatedly seek for zero-width seek range.
When there is a zero-width seek range, don't repeatedly try to
reposition the playhead to keep within that range.  This simply adds a
small buffer around zero-width seek ranges.

Closes #1331

Change-Id: I87b787f1454750eaa2caafa7c23cb9e37d3328e6
2018-03-07 19:02:05 +00:00
Jacob Trimble c37b5e9513 Allow multiple EMSG boxes per segment.
Closes #1340

Change-Id: I6e539ee54ca77f2069fd74c28f8e0d3ed870860f
2018-03-07 19:00:36 +00:00
Joey Parrish b27ea82e7f Allow Player to attach/detach from video
This adds attach/detach methods to replace the media element in the
Player constructor.  Now applications can take back control of the
media element or provide a reference later in the Player's life cycle.

This also allows applications to decide whether or not to set up
MediaSource in advance, through an optional argument on attach and
unload.  The default will be to set up MediaSource in advance, which
maintains current behavior.  This advanced setup of MediaSource can
improve load latency later.

This change also introduces async/await for the first time in the
project, which required changes to eslint config, Closure build
arguments, Babel & Babel-polyfill setup, and the esprima parser used
by our extern generator.

The use of async/await will improve readability in many places, and
these infrastructure changes to enable async/await should also unblock
issues #1336 and #1337.

Closes #1087

Change-Id: I0d6b4e0e2af27a6520a3d070fa92b7139b2cb8b0
2018-03-06 22:19:53 +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
Jacob Trimble bfb42c69c4 Make EME polyfills independent.
Now each EME polyfill can be removed independently; this allows
someone to remove just the IE11 polyfill while still keeping the
others.

This adds a priority ordering to the polyfills so the nop polyfill
will be run last as a fallback if there are no other polyfills.

Issue #1261

Change-Id: I865e1c0d6a73a079dd91505e96572e215e6f6c6a
2018-03-06 21:34:25 +00:00