You can either abort downloads one at a time, using the
AbortableOperation interface, or you can implicitly abort them all at
once by destroying the storage instance.
Closes#2417Closes#1362
Issue #1301
Change-Id: I0ba102e5bf60a063f0e2f6ecd3f135445226996f
In the process, this removes the in-progress flag, which should fix
issues where the storage instance can't be re-used after an error.
Closes#1432Closes#2432
Change-Id: I51018e170fb9ab262b5c70125a03d979c8ccfb08
In Change-Id If885e828b4761528e40abdbc601a11cf13849a1e, I fixed a
memory leak, but broke offline storage.
The fix for the memory leak was to release SegmentIndexes and
SegmentReferences when the DASH parser stops, but offline storage was
stopping the parser before making use of the parsed manifest.
This changes offline storage to keep the parser alive until after the
storage operation is complete.
This bug did not affect any release versions.
Change-Id: I88b86d250b4407cc0740d35eaf4a7ef3d5a67798
This brings the field name in line with the Stream objects from the
manifest types, allowing for more general processing of Stream and
StreamDB for period-flattening.
Issue #1339
Change-Id: Ic5d0e5d69a6560d475a19f5d3ecb0b1b40b8d271
Period-flattening will concatenate Stream objects, so this information
should be available per-Stream instead of at the Variant level.
Issue #1339
Change-Id: I96195fea48cab1e4a349b2ab0b16064a443e928a
This removes periods from the internal manifest structure and cleans
up code and tests accordingly. This leaves us unable to play
multi-period DASH & offline streams until the main period-flattening
algorithm is completed in shaka.util.Periods.
Three test cases have been disabled for the moment.
Multi-period playback will be restored in a smaller, more focused
follow-up commit, with disabled tests re-enabled.
Issue #1339 (flatten periods)
Issue #1698 (rapid period transitions issue)
Issue #856 (audio change causes bitrate change)
Closes#892 (refactor StreamingEngine)
Change-Id: I0cbf3b56bfdb51add15229df323b902f0b2e643a
When playing an asset, the player will first choose a codec, based
on the lowest average bandwidth.
However, the storage mechanism did not have any such filtering;
instead, all it did (if using the default track filtering plugin) was
pick the middle-bandwidth audio track. This lead to it sometimes making
different codec decisions than the player would have.
This CL breaks the codec filtering logic out into a helper function, and
calls it both for playback and storage.
It also adds headers comments to some functions in the demo page.
Closes#2390
Change-Id: I09f1a24753121afd0e7500577c0f64ccffe5a4d1
This reverts commit 235e4e11ad.
The effort to remove SegmentReference's position field will be handled
in a different way.
Issue #892 (refactor StreamingEngine)
Issue #1339 (period flattening)
Change-Id: I62b115137abc89f498b30467e574b0401dcad05d
As part of Period-flattening, I'm trying to reduce our dependence on
the "position" field of SegmentReference. If it can be eliminated, we
can more easily concatenate Arrays of SegmentReferences without
modifying them.
SegmentIndex can now track the last reference you asked for and
iterate through the list of references. This means we don't need the
"position" field of SegmentReference, which means we don't need to
know positions in advance or globally. StreamingEngine will no longer
use position to request segments.
The old methods find(time):position and get(position):SegmentReference
have been replaced with seek(time), current(), and next(), all of
which return a SegmentReference and maintain an internal pointer to
the "current" reference. Care has been taken to maintain that pointer
during the evict() and fit() operations. Recent changes to merge()
made sure that the pointer does not need to change during that
operation.
All test updates are related to the SegmentIndex API change, not
changing expectations or behavior.
Issue #892 (refactor StreamingEngine)
Issue #1339 (period flattening)
Change-Id: I1682dcc2dd625c6e390711538e46d31e6eb6cea8
Player.load and Storage.store used to accept the manifest parser factory
directly. But now they should only accept the MIME type string. This
removes the deprecated functionality in preparation for v2.6.
Change-Id: I1b4c5a4a9f0b6edbea909d18111ddc87a39da331
Instead of having the "factories" use "new" to construct them, now they
will be plain functions.
Closes#1521
Change-Id: Ia6151ad679a78a5c6db128d43094c82add0af348
PR #2387 introduced a bug. It awaited the track selection callback,
but that was done in a loop, the results of which were not awaited.
This would cause storage to continue before the complete list of
tracks was available.
Closes#2383
Change-Id: I18a429cf0f40b829020c520c622ffdae8b12622e
Since v2.5.0, we have been storing duplicate streams for multi-period
offline content. For example, instead of storing one stream per
period, a 3-period manifest would have 3 streams per period. The
segment data would also be duplicated, leading to 3x the storage used
for a 3-period manifest.
This fixes the error for future content and ensures that the correct
number of variants are still shown when this broken content is loaded.
This change also tweaks the frameRate field in the existing database
dumps, which for some reason contained the wrong value for the
existing v1-v3 dumps. This must have been a bug we fixed already. To
make the expected results consistent across dumps, the frameRate value
in the old dumps has been updated.
Closes#2389
Change-Id: Ibf7db7543f25ad23cecd12efad1eb039630e381c
This changes the eslint rule to enforce a strict pattern for the
argument comments. The comment must appear before the argument and
must be /* foo= */. This still ignores line comments.
Change-Id: I3afb01c65e1088eda13facb3aeeaa7595a2f5aee
This is a step along the way to flattening periods, and also
simplifies a few small things in StreamingEngine and tests.
Issue #1339 (flatten periods)
Issue #892 (refactor StreamingEngine)
Change-Id: Ie17cd5e15ed6ec9290a918c3a69c05c74581e0fc
SegmentReference used to have presentationTimeOffset, which,
subtracted from the period start time, was then _added_ to the
timestamps in the segment by MediaSource.
Now, SegmentReference has a timestampOffset field, which is exactly
what MediaSource's timestampOffset field is set to on the SourceBuffer
before this segment is appended. For DASH, this is periodStart minus
presentationTimeOffset.
This also adds append window start & end times to the
SegmentReference. Now segments can be appended to SourceBuffers
without reference to the period.
Note that start & end times of the SegmentReference in each segment
index are still relative to the period. This will change in a
follow-up.
Issue #1339 (flatten periods)
Issue #892 (refactor StreamingEngine)
Change-Id: I9d54eb2b529ec643c9475b8e9d218c3e2e826a26
This reflects changes in Google's policy on JavaScript license
headers, which should be smaller to avoid increasing the size of the
binary unnecessarily.
This also updates the company name from "Google, Inc" to "Google LLC".
Change-Id: I3f8b9ed3700b6351f43173d50c94d35c333e82b4
The PR to add support for pulling EME init data from the segments was
incorrect and had some bugs. This stops re-initializing DrmEngine since
this isn't needed and could cause problems with the offline licenses.
This also just uses the Pssh helper once to parse and extract the
init data. Lastly this throws the old error if we don't have any
sessions when we are done; if we try to store WebM content, we should
still throw if there is no init data in the manifest.
Issue #1531
Change-Id: Ie524abda993a076397e233008709f11a2e68a8f8
This reverts commit 6e5a0797de, #2042.
The PR as it landed broke some test cases and functionality for storing persistent licenses, and it doesn't seem to work even for its intended use case.
To prepare for flattening out the manifest structure to remove
periods, this change moves initSegmentReference and
presentationTimeOffset fields into the SegmentReference object. This
way, the segments on either side of a period transition or HLS
discontinuity can have different offsets or init segments, eventually
allowing us to create a single array of SegmentReferences for
multi-period content.
Issue #1339
Change-Id: Ic7eff0483789644881247ecf8044c5fb6a48f0e6
* fix: Reference issue with SegmentReference createUris
* test: Added Segment GetUris Test for timeline
* feat: Get PSSH from segements if not initdata exists
* feat: Get PSSH from segements if not initdata exists
* fix: JSDoc comments and moved drmEngine update to storage
* fix: Remove comments
* fix: Remove unused import
* fix: Lint erros and dedup initData code
* fix: remove no init data test and add check for use persistent license
This replaces find/get callbacks in Stream with a SegmentIndex. With
the exception of DASH's SegmentTemplate+duration, all manifests were
already backed by SegmentIndex. Now, all manifests are backed by
SegmentIndex. This will simplify Period-flattening, in which all
tracks will be represented by a list of segments, some of which come
from different Periods.
The SegmentIndex in Stream will not be created until
createSegmentIndex is called. Prior to this change, the find/get
callbacks could be invoked without createSegmentIndex() in some cases
(excluding DASH's SegmentBase), which some lazy tests took advantage
of. Now that find/get are methods on SegmentIndex, createSegmentIndex
must be called in all cases. The tests have been updated accordingly.
Making SegmentIndex generation async in all cases exposed some issues
with the parser context being modified in-place between one
Representation and the next. So the parser now makes a shallow copy
of the context before it is bound into an async callback.
To facilitate updating the SegmentIndex for SegmentTemplate+duration
content, SegmentIndex now has a method to update its list on a timer.
Once per segment duration, the index will be updated to add and remove
SegmentReferences.
The initial expansion of SegmentTemplate+duration will be limited to a
relatively small number of segments, to avoid excessive CPU or memory
consumption. This defaults to 1000 segments, but is configurable.
Issue #1339
Change-Id: I99c007b1096c3b396d04a729750cd7b743cb899d
This changes several classes to use the Destroyer class to handle
destroy(). This also changes the behavior to not ignore destruction
and instead throw a new error. This is more clear for callers and
ensures we propagate errors.
Change-Id: I756c085639558509c22e5c43d69ddf4acd28d46f
This is a fully automated change. The linter will fail because the
extra indentation caused line-length errors. These won't be fixed
automatically. They are fixed in a follow-up to make this one fully
automated.
Change-Id: I4d8cf9c998985add2bcd24a81c8d65495668c4f3
With the new style rule, we cannot have two statements on the same line.
So we can no longer have an "if" on a single line and we cannot have
an arrow function with a body on the same line as when it is used.
This is mostly a manual change.
Change-Id: I2285202dd5ecbad764308bc725e6d317ff2ee7f0
This enables the eslint rule that requires all functions to consistently
either return a value or not return a value.
Change-Id: I98b579f3689c3b6c74968116824231bb792bd9dd
With this change, offline and UI config can use the same two-argument
short form that the Player config interface offers.
Change-Id: I5f40ef58da76f3aab1d7178fe7d6e82097352b9a
This is an automated change to convert use of "function" functions
to arrow functions. This doesn't change all uses of bind() that
could be converted. This also doesn't remove all "function" functions.
Change-Id: I40ac7d086bcef947a1be083359c8fd1d4499a9c3
A coming update to the Google eslint config will require using "const"
over "let". This makes that one change to isolate the big changes.
Change-Id: I7d0974c3ae15c53cc45a6b07bf9f6586e2d34aca
At the moment, the storage manager does not support multiple concurrent
downloads. This modifies the demo to create a new storage instance every
time a storage operation is desired, then dispose of that instance after
the operation is complete.
This also refactors out the shaka-main-offline-changed event, which was
no longer necessary after allowing asset cards to re-load their buttons.
Issue #1432
Change-Id: I1312cf74a92f877279adb461e423a38e93bcfa0f
It is type-safe to alias a class, but not one of its static methods.
Aliasing the method without the class makes it a "free call" to invoke
the aliased method.
A "free call" is when you call a method without the context of its
instance of class. There were several cases of this with static
methods.
This will be enforced by a future release of the compiler, which I
believe will lead into compiler support for "this" in static ES6
methods. In ES6, you can use "this" in static methods to refer to the
class and call other static methods. Closure compiler doesn't support
static "this" yet, but we will start using it as soon as it is
supported.
Change-Id: I4249db8b6dda9231ebba60ee0d4ad734a692c2fe
We support these older ones and warn about the deprecation, so do not
also leave the older configs and trigger an error from configure.
Change-Id: I49e25e43ce556ff54ad3c1f1408699ff36c31833
In four different places in our code base, we did the same
work to create a segment request. The bulk of the work was
based on setting-up the range header.
This CL creates a common utility that will create the request
for us while keeping networking engine as ignorant to segments
as it was before.
Issue #1788
Change-Id: Ie3dc2a99a34b3925fecbfdaae7b1e178a0b7a3b6
Replace the last use of |Destroyer.with| in the library. The final use
was in Storage, and this CL replaces that last usage with try-finally.
Close#1516
Change-Id: Ic0946a564b66a48b567ffd6d1cfd4b9ec76fc039
To make it easier to work with destroyable objects, we defined
|Destroyable.with|, but it looks like using try-finally may be easier.
This CL replaces the use of |Destroyer.with| in |Storage.remove_| with
try-finally.
Issue #1516
Change-Id: I75563335f5a5865f93bc1eb21346300c36e0a13e
To make it easier to work with destroyable objects, we defined
|Destroyable.with|, but it looks like using try-finally may be easier.
This CL replaces the use of |Destroyer.with| in |Storage.list| with
try-finally.
Issue #1516
Change-Id: I29dcda7e8990402f0edb5885eed1c546ab28400e
Refactored |StreamUtils.getAllVariants| to get variants from a collection
of periods (rather than a manifest). This allows us to avoid needing to
assert that the manifest exists (when we know it will).
Looking long-term, as part of the refactor the method was moved to a
period-focused utility class. The goal of this is to make it easier to
see what methods may go away when we flatten periods.
Change-Id: I50aa97583892361ee4714a7beaf61e4cd95fb6b4
Rather than have the manifest parser class return the factory
that we then need to call "new" on, we can just have the manifest
parser class return the parser.
This makes the call-sites in Player and Storage simpler and moves
the use of factory+new to one spot so that it will be easier to
remove in 2.6.
Change-Id: I2abb8da603c9226c230bb761a20eb8dd20fc8455
Download manager would previously queue all the requests and
then start them after |download| was called.
By making download manager start downloading each group once
the group is created, it allowed for the internals of download
manager to be simplified.
With this simplification, it is far easier to understand how the
destroy flow works.
Change-Id: Ie2d7776eae4224e2ff1c607353c22750daa4c14f