Commit Graph

2107 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 66abf9cb27 Remove all protocol-relative URIs
According to @beaufortfrancois, we should no longer be using protocol-
relative URIs.  He quotes this passage from Paul Irish:

> Now that SSL is encouraged for everyone and doesn’t have performance
> concerns, this technique is now an anti-pattern. If the asset you
> need is available on SSL, then always use the https:// asset.

> Allowing the snippet to request over HTTP opens the door for attacks
> like the recent Github Man-on-the-side attack. It’s always safe to
> request HTTPS assets even if your site is on HTTP, however the
> reverse is not true.

Source: https://www.paulirish.com/2010/the-protocol-relative-url/

This change was begun with the following command:
  git grep -l "'//" | xargs sed -i "s@'//@'https://@g"

Some changes made by that command were false-positives, which I then
reverted manually.  Others required additional cleanup to meet style
rules.

I've also just discovered that the "max-len" rule in eslint's Google
style config exempts URIs, so there's no need to disable the max-len
rule on URIs in the assets list.  These have been removed in the asset
list where unnecessary.

Finally, testing these updated URIs led to the discovery that two of
our third-party demo assets are no longer available.  One URI needed
to be updated.  The other had no obvious replacement, so it was
removed.

Closes #1390

Change-Id: I2fe23faec04f1904c1741236b364d5089900092a
2018-04-09 18:06:18 +00:00
Joey Parrish 6bdbebfa47 Minor cleanup of null checks on non-nullables
Change-Id: I924c267be2b8fc689391ed888f08707e0bd574e0
2018-04-09 18:05:04 +00:00
Patrick Kunka 8743bcfcea Explicitly bind to window for ES5 strict mode compatibility (#1398) 2018-04-09 11:01:59 -07: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 6a02bd25d3 Update upgrade guides for v2.4
Closes #1342

Change-Id: I2cbb8933abe833afc74471efb6ad1e3e40bb1c28
2018-04-06 17:40:51 +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
Joey Parrish b15d4d3f4e Add support for generating externs for ES6 classes
This is necessary to allow the exporting of AbortableOperation.

Change-Id: Id343fe147b0ec5c1f653a679bb6472c222b2c59a
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
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
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
TheJohnBowers 7935be5cfc VDMS manifest servers no longer set cookies, and so players (#1388)
We should no longer set "include credentials" on VDMS license
requests.  Doing so results in a CORS error. This change fixes
playback of a couple assets in the demo player.
2018-04-02 23:32:02 +01:00
Theodore Abshire 4327153007 Loosen tolerance on CEA-708 captions test
On some platforms, the sample used in that test leads to a
buffer start time of 1.4; on other platforms, it leads
to a buffer start time of 1.4667333333333332.
Perhaps this is a result of the implementation-specific rounding
differences in different mediaSource implementations, or perhaps there
us a very small gap in the content that some platforms handle slightly
differently.

Either way, this change loosens the tolerance on the check. That buffer
start time check wasn't the important part of the test, anyway.

Fixes: 77471871
Change-Id: I866fafe671566cc7116e7c99222f75225cffd476
2018-04-02 14:11:31 -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 f2244d1aa7 Added FAQ entry for forceTransmuxTS
Change-Id: Ibe090fb3224c192cf389caebc0bbfedeb449f4ae
2018-03-30 12:13:12 -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
Joey Parrish ad7602f3b7 Add copyright headers to jsdoc template code
This is required by Google policy, to document where these forks came
from and what their licensing terms are.  I overlooked this detail
when I started customizing the JSDoc template.

Change-Id: Ifd18bb3143ca841e2bd934fe571f3a896ba53975
2018-03-29 11:04:35 -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
Joey Parrish 8bce0b34e6 Build docs before publishing on npm
Change-Id: Id79f8a68cbfbb2462fca24210447bb7fee83a68e
2018-03-29 10:31:48 -07:00
Joey Parrish 0532baf027 Update changelog for v2.3.5
Change-Id: I095dcb1c5968c58258add3ba3c2aaf3cc66ac45e
2018-03-29 09:54:58 -07: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
Theodore Abshire f22a00aba7 Quarantine CastUtils.TimeRanges.deserialize
This test has been flakey on OSX for quite a while, but it was very
occasional, and the likely cause of the flake is unrelated to the test
itself, so it was never really dealt with.
Recently, though, the test has been failing repeatedly on the BuildBot.
This change quarantines the test so that the BuildBot will stop failing.

Issue #1215

Change-Id: I1a721976c277cfb9324b0b3f9cf8eae49b17d1ca
2018-03-28 17:27:34 +00:00
Joey Parrish 4b6b9cbe55 Add a startTime parameter to the demo
Useful for debugging issues involving the start time of live streams.

Bug: 75276747

Change-Id: Ida834171a7835451719800bb43d021e886a0b591
2018-03-27 15:39:06 -07: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
Joey Parrish c6f7e4cf0a Fix demo background, margins on TV
When testing TV devices by loading the demo or support page directly,
some rendering issues were found.  This fixes rendering of the support
testing page and the demo (in noinput mode) for TV devices such as
Chromecast.

Change-Id: I8b659d9a67e4829a48b2ec912685f131025c1575
2018-03-27 17:24:51 +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
Joey Parrish 4f95bf2c1b Update changelog for v2.3.4
Change-Id: I9ae6da08e9aaf6a027d3712c8e425aa8307f8607
2018-03-22 18:59:01 +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
Jacob Trimble 938da032b5 Allow non-decimal formats in SegmentTemplate.
Fixes: 75988239
Change-Id: I023a1bd003662c6d651eb870b4aba025dc687327
2018-03-21 22:41:26 +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
Theodore Abshire 987dc9e77c Typo fixes and rewording in comments, part Final
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: I93d0f3faedb8a42423b6971f6499d651b20492d1
2018-03-21 19:45:22 +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