This corrects/normalizes license headers in misc. files, such as
config files, docs, build tools, tests, and externs. This does not
affect the compiled output, and is only done for consistency.
Issue #2638
Change-Id: I9d8da2de55243b08d7df2b743aac73c6f15e858a
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 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 allows us to avoid suppressing the indentation rules and ensures
we have correct indentation. It also makes it harder to make mistakes
since the variables are only accessible within the callback and you
can't accidentally contaminate another object with an incorrect call.
Closes#1692
Change-Id: Ic38b5cd57a2587dfc8c115ba782656c15565b655
This ensures that we get the expected types and that type coercion
doesn't convert between types. This also ensures we are consistent
in how we check for equality of primitives in tests.
Change-Id: I9f3aacdf25ab1afe5e8d6e4b895b5299ee687d54
We use custom indentation for the ManifestGenerator to make the repeated
calls easier to read. This disables the coming linter rule for these
blocks of code. This also goes through and unifies the formatting. The
indentation should be 4 spaces from the left side.
Change-Id: I687e69cea39bded1e9e06bffdcc888970b383fa2
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
Instead of duplicating the default configuration values in each test,
this now uses the default configuration methods.
Change-Id: Ifd2ab349db7903a2acb0d06fed4bd0ccd5050b35
This method was removed during the Variants refactoring. This method
uses jasmine's asymmetric matchers to only match some of the fields.
This is important for tests so they only test the relevant fields.
This also removes implicit reuse of stream IDs. Stream IDs must be
unique and there is a new method for cases where the intent is to
use duplicate streams.
Change-Id: I185df5f0beb018169ff537abb952ee4ebbf49be6
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 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
A bug in our Promise polyfill caused issues with the recently-added
AbortableOperation class on IE11. Since external polyfills for this
are smaller, it is easier to remove ours in favor of a third-party
polyfill. Applications that wish to support IE11 must now load this
additional polyfill.
We are using the "es6-promise-polyfill" module from npm, but any
compliant polyfill should suffice.
One feature our own polyfill offered was the ability to flush all
Promises, which allowed us to write synchronous unit tests that
simulated async processes. To get this ability back, we are now
using the "promise-mock" module in our tests.
Getting "promise-mock" to load correctly involved switching from
"requirejs" to "cajon", which builds on requirejs and supports
AMD modules more directly.
Closes#1260
Change-Id: I5de48e88a910736ae5c1897a7a509bc5641acb70
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 is part of adding a new conformance rule to add additional type
safety. This will disallow using properties of unknown types or using
unknown properties.
The first parts will be fixing errors caused by the new rule. These
are backwards compatible, so can be applied before the rule is enabled.
Once all the errors and bugs are fixed, the rule will be enabled.
Change-Id: Iefde089b2f62ddfdf43944cda5badab438577561
The old definition using a union with a Function causes problems. The
compiler tends to treat this as an unknown type, so we loose type
safety. The new types ensure full type safety, at the cost of needing
to "convert" the spy when it is used as a function.
Change-Id: I98ebd9dffd9cb865d0cf5d03db0fb5d6ea001ed3
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 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
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
Forcing the use of the Promise polyfill allows us to remove the hacky
parts of fakeEventLoop and gives a huge boost in speed for the tests
that use it, particularly on Edge where the delays were large. Many
fakeEventLoop tests can now run synchronously.
Time to run tests in our lab before this change:
- Edge: 21 minutes
- Safari: 6 minutes
- Chrome, Firefox, Opera, IE: 6-7 minutes
Time to run tests in our lab after this change:
- All browsers: 5-6 minutes
This also reduces the incidence of Safari failures in our lab, but
that issue does not reproduce on other machines. It looks
increasingly likely that our lab machine is faulty and needs to be
replaced.
Change-Id: I7bdcc6830c8fdf298538ce6538b1ca8e1b92cab2
All tests now have the same timeout value. This should simplify the
process of addressing timeouts on Safari.
Change-Id: I3b455bd639758007ec8b2b86ef236c56e919c15a
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