This fixes all the license headers in the main library, which corrects
the appearance of the main license in the compiled output.
It seems that the `!` in the header forces the compiler to keep it in
the output. I believe older compiler releases did this purely based
on `@license`.
Issue #2638
Change-Id: I7f0e918caad10c9af689c9d07672b7fe9be7b2f3
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
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 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
This is a helper to aid in iterating over items. This returns a list
of objects that contain:
- "item": The current value.
- "prev": The previous value in the list.
- "next": The next value in the list.
- "i": The zero-based index in the list.
Issue #1518
Change-Id: Id18ab977e3ae45dfbfd2b4137a1bffb6e53c6bce
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
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
This change makes restrictions on AbrManager into "soft" restrictions.
This means that if these restrictions cannot be met, AbrManager will
still choose something instead of throwing an error.
This is in contrast to top-level restrictions or DRM-based
restrictions, which are "hard" restrictions that will stop playback if
necessary.
This change also fixes some minor issues with the SimpleAbrManager
tests, such as cross-test pollution in the restrictions object.
This is a lead-in to issue #855, where AbrManager's restrictions will
have their defaults changed when the "saveData" signal is present in
the browser.
Change-Id: Icdb2ff5df7ceb0d94f1267bf81e59dede3c2baf9
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
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
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: I8f857a24e4c1ad336177d23dfed4f4a29d3262d2
While I set out to fix failing assertions during playback, I found
many more changes necessary to clean up the code and make things more
consistent.
When we changed switch history to include variants instead of streams,
we broke the filtering logic that is applied to the history. This
caused assertions at runtime that were not caught by the tests.
This moves the filtering logic to addToSwitchHistory_ and makes it
aware of variants. It also adds a regression test that would have
caught the assertions.
This fix affected many other tests, though, which necessitated other
API changes and cleanup.
Many interfaces are simplified, as is switching logic in Player. The
data flow is also easier to follow, since there are fewer transitions
between variant and stream. Everything up to StreamingEngine uses
Variants, and StreamingEngine uses Streams internally.
- All stream-based interfaces on AbrManager replaced
- switch callback takes a variant
- chooseStreams replaced with chooseVariant
- setTextStreams has been dropped
- Player maintains compatibility with old interfaces until v2.3
- Most stream-based interfaces on StreamingEngine replaced
- onChooseStreams callback to Player returns variant & text
instead of a stream map
- switch was replaced with switchVariant and switchTextStream,
both of which delegate to switchInternal_, which is largely
unchanged from the original switch method
- still has getActiveStreams, which I hope some day can become
getActiveVariant and getActiveTextStream so Player no longer
has to convert anything
- Most stream-based logic in Player replaced
- deferred switches map broken into variant and text members
- switch history logging broken into simpler variant and text
methods
- simplified manual and automatic track selection logic using
new AbrManager and StreamingEngine APIs
- player no longer filters duplicate selections, StreamingEngine
handles that
- replaced one case of deferred switches with an assertion
Closes#954
Change-Id: Ia49f6ffb9c5fa13ed8790dd03eeeded5122f7683
This change makes ABR targets configurable and refactors player
to accept Abr Manager factory rather than have manager be
part of ABR config.
Closes#744
Change-Id: I732daaf555d21cc9e79450eeb1f74ac3544b90cc
This adds a severity field to Error objects. This can be used to
detect whether an error is recoverable. All the same errors are still
reported so the field can be ignored.
There are two possible values:
* RECOVERABLE means that the Player will try to recover from the error
* CRITICAL means the Player will be unable to continue and must call
load() again
Closes#564
Change-Id: Ie2c5468340c13e7a288b99690ab65b7ecc0a6b29
This adds a second Restrictions object to the Player configuration to
restrict ABR decisions. The original restrictions will remove any
non-matching streams from the manifest, like before. This new
configuration will only apply to AbrManager choices. Any restricted
track can still be explicitly selected using Player.selectTrack.
Closes#565
Change-Id: I52379b096e81f97df22b6683669c5787694d87e7
This allows the networking plugins to pass the duration it took for
the request. For example, if a plugin were pre-fetching the segment,
this allows the plugin to tell NetworkingEngine about how long it
really took to download.
Closes#621
Change-Id: Ie67e3f99389cf02d5b4a345bde06ccc418b6e91c
An upcoming compiler release will allow us to generate externs from
exports. Because of that, we are adding some extra exports which are
otherwise not needed at runtime.
- Export properties which implement an interface
- Export classes which are referenced in external APIs
- Export base classes of other exported classes
Change-Id: I78b3a4569b4b82b0a9d8993978faf268c2a791d9
SimpleAbrManager will still choose the middle audio stream by default,
but will adjust audio up or down once video has been chosen. Video
will be downgraded before audio, and audio will be downgraded only as
a last resort.
For audio-only content or content with one video stream and many audio
streams, audio will be chosen to fill available bandwidth, just as it
already was for video.
Change-Id: Ia4a0e9607d860713a5ad7887ac6a9aa04767eb25
Clearing ahead of the playhead is causing hiccups in playback on the
following browsers:
* Chrome (all platforms, inconsistent)
* Edge
These browsers appear not to be affected:
* IE 11
* Firefox
* Safari
This is a manual change that reverts almost all of:
* a8ac3142 - Make buffer clearing behavior explicit
* 4593cf78 - Check position against null, fix bug in a8ac3142
* 10b3dd0a - Seek after clearing a buffer, workaround Chrome bug
* 6daa7f3b - Allow AbrManager to clear ahead of the playhead
Clearing the buffer is now an all-or-nothing proposition because that
is the only way to get consistent playback quality across browsers.
This comes at a cost, because we can no longer count on the ability to
remove buffered data on upgrade without a stutter.
Issue #520
Change-Id: Ia6f8b2fcb223f9c50e9829b26d7003ae8f6efb8d
- Speed up EWMA estimates (lower half-lives)
- Drop min delay concept
- Trust the estimate after a certain number of bytes have been
sampled (128kB)
- Take samples as small as 16kB (previously 64kB)
- Drop startup interval, just wait for estimate to be trustworthy
The result is much faster initial adaptation when the default
bandwidth estimate is too low, without sacrificing startup speed in
low bandwidth situations. The best track is selected right away,
and is visible after the first two segments have played out.
In a high-bandwidth scenario using our test clips (Angel One and
Sintel), the initial ABR decision is visible 2.4x to 4.4x faster now.
Decision speed is now largely independent of available bandwidth.
Change-Id: I121f4dd44b725dc53de61c02f7afea14d9234df6
- Replace both boolean clear and number-of-seconds args with an enum
indicating a specific type of clear behavior: none, all, or most
(all but 2 segments, currently).
- Calculate segment size from the content in StreamingEngine, rather
than assuming a common segment size in AbrManager.
Change-Id: I9e4fee0945d5e50fd7da86bb8467911e60c4575e
Before, when we adapt we tell StreamingEngine we are in an unbuffered
state. This causes it to download segments at the playhead, even
though we have some buffered. Normally this does not cause problems,
but on Edge, it can cause skipping. So now, StreamingEngine will
use buffer end to determine which segments to download.
Issue #446
Change-Id: Ib1f4cd3a1627efa957825eb0445c99f753f31e7b
This will allow us to pass only audio stream sets when a language
changes, which will remove the need to filter the output of
chooseStreams in Player.applyConfig_.
Working toward a solution for #435
Change-Id: I893d13882809ef461b16c6c9426c8e9e33604c02
SimpleAbrManager will now leave 5s of video ahead of the playhead and
clear the rest when upgrading to a higher resolution.
Also smooths transitions for overlapping segments by scheduling an
abort() call to reset MediaSource internals after removing content or
changing the append window.
Related to issue #435
Change-Id: Ie036515388e1e7e4b3b8f3ab9922e3d5e7ed2627
This allows applications to reset the Player's AbrManager
and to use SimpleAbrManager in their own ABR
implementations.
Issue #355
Change-Id: I58d06c1d547b83b3221a30518620ad2352e97636
Now the application can restrict the kinds of tracks that the Player
will play. This is done through player.configure(). This also
allows restricting the playable tracks based on the EME key status.
Closes#326Closes#327
Change-Id: I88210ece6fd1db886c49d4599fbe5814d394132d
Now, the default bandwidth estimate used is configurable and can be
set using Player.configure.
This also moves enableAdaptation and abrManager configuration values
to a subcategory 'abr'.
Closes#268
Change-Id: I11ab30452b20dc4fd9385210811185fe2969821e
- Fire adaptation event when AbrManager calls switch.
- AbrManager only calls switch when something needs to change.
- Wait for StreamingEngine.init to complete before firing the first
AdaptationEvent.
- Fire trackschange event when we change periods.
Change-Id: I1701afbe71caae87a93c379a71911541c7bda86a
This greatly simplifies things for the caller, who can simply call
load() multiple times instead of waiting on cleanup or creating a new
Player instance.
Change-Id: I83ec5ee7f7de2b652d0f193f4b6ece1971c80c16
Using goog.asserts will work with the compiler. So rather than
simply casting a nullable value when passing to a method, we can use
an assert which will correct the type and print a log if it somehow
is null.
This is not the same goog.asserts found in closure library, this
simply calls console.assert, but it is not required to do anything
for the compiler help.
Change-Id: I2548e39e772f0aa7ec41437cf9f5a2be383e0fbd
Before there were two style to indent comments after an annotation,
using 2 and 4 spaces. Now this only uses 2 spaces.
Change-Id: Id06415d7193cc154a2768fb3932aff7a06b7ed32