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
The StreamingEngine tests use various fakes that did not have strong
type info before. The new Closure Compiler won't allow this, and for
good reason. Cleaning up the type info exposed a few ways that we had
left out important things or failed to remove methods that are no
longer on the types we're faking.
We also had some fakes for StreamingEngine tests that were redundant
with strongly-typed fakes that already existed in shaka.test. This
deduplicates them. The fakes for StreamingEngine are now just
instances of the other fakes with specific behavior attached.
Issue #2528
Change-Id: I0da67bea462e855fcfcb1b391fe83027ffa70702
Something weird happens on some platforms (variously Chromecast, IE,
legacy Edge, and Safari) where the playhead can go past duration. To
cope with this, don't fail on timeout. If the video never got flagged
as "ended", check for the playhead to be near or past the end.
Also, wait for playback to begin before increasing the playback rate.
This improves test reliability on slow platforms like Chromecast.
Change-Id: If7d70de95b75e602853ec77ad1c285c118875db4
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
As part of Period-flattening, I'm trying to remove our dependence on
the "position" field of SegmentReference. With that eliminated, we
can more easily concatenate Arrays of SegmentReferences without
modifying them.
- Make SegmentIndex iterable
- Add specialized seek() and current() methods to SegmentIterator
- Remove position from SegmentReference
- Make positions in SegmentIndex API stable without field in
reference
- Remove brittle hard-coded positions in tests (except SegmentIndex
tests, where they would be hard to avoid in testing methods
separately)
- Use SegmentIterator in StreamingEngine to track the next segment
between switches
Issue #892 (refactor StreamingEngine)
Issue #1339 (period flattening)
Change-Id: I666cc21249c34ee6cbc138a59109d9f1159fa127
We fetch the previous segment in Live streams to combat differences
between the manfiest times and the segment times. Now this can be
configured so apps with correct manifests can avoid the extra segment
request.
Also, we'll update the buffering state when a segment appends so we
leave the buffering state sooner.
Issue #2291
Change-Id: Id12c8132dc11739e4c8d42cb1f08e6ae7da1a966
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 method should probably never have been in the library, since it
creates a fixed-sized, muted element.
Change-Id: I53b474305465bef34d43ce40ec5e7dedceb20a25
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
This tests wasn't working properly before since the 'onBuffering'
callback wasn't given to StreamingEngine. This test was broken on
Edge, but at some point got fixed (or Edge fixed it's behavior).
Fixes#1743
Change-Id: I0af48207f5e8ad1c2e5007967a093f243e1837c9
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
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
Rather than only aborting a request if the new request is smaller
(effective when adapting down), abort if the new request will be done
"on time" (effective when adapting up) without causing buffering.
Change-Id: I7572b8bfc566a4f264a5080e4c1bc983f1363ce0
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 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
In our tests, we overwrite timestamps in segments to simulate streams.
In some cases, the init segment contains two different timescales:
one in the mdhd box and one in the mvhd box. In fact, the mdhd box is
what the browser uses to interpret the tfdt box timestamps. So the
mdhd box is what we should be reading, not the mvhd box.
This change fixes gaps in the test content generated from the multidrm
clips in our integration tests. These were not detected before
because the tests in question never played beyond the first segment.
An unintentional change in buffering thresholds (fixed in an earlier
change) allowed us to see these gaps for the first time in our tests.
The buffering threshold change caused a buffering state in the offline
integration tests some small percentage of the time, which caused the
test to never reach its target timestamp.
This fixes the gaps by using the correct timescale to calculate the
timestamps for the tfdt box. We knew this was an issue in theory as
far back as December 2017, but this was the first time our tests
actually failed because of it. In most of our content, the two
timescale values match. In the multidrm content from Axinom, they do
not.
Closes#1206
Change-Id: I863db30a16417a84f8e5df42f4d533b47fa4e7dc
There is a workaround for a Tizen bug which appears in many of our
test suites. To avoid having to add this to yet more, this change
factors out the workaround such that it applies to all tests.
Change-Id: Ie34c81bfcac94310bf3cd021fd4f2d55905b647a
The init method on streaming engine is responsible for initializing
streaming engine but it also starts the streaming process. In the
greater scheme of things, this is what starts playback.
To help communicate the full effect of what this one method does, this
changes its name to be "start" which helps show that it is starting a
process, not just initializing.
Change-Id: Ieceecce85917d97277782f41fd376fc6f97eaac9
We need to have a playhead for media source and src=, however the
current playhead implementation is tied very tightly to manifests.
Rather than working to refactor playhead, this change defines an
interface and makes the old playhead the Media Source implementation of
the interface.
In a later change the src= version will be introduced to allow playhead
functionality when we don't have a manifest.
Issue #816
Issue #997
Change-Id: Ie74e50839c79c3cd3acf14000849e3d5fa71a42f
Before, media source engine could be created with no text displayer.
However, player would always create media source engine with a
text displayer.
Just like with closed captions, this appeared to be a good time
to change it to be passed in the constructor and have media source
engine own it.
This now means that media source engine is responsible for destroying
it - lessening player's responsibilities.
Change-Id: I71cd1c28a3c22d3c765a3892fe74ae3f9abd1914
This change takes playhead and its internal members and moves them
over to use the IReleasable interfaces instead of the IDestroyable
interface.
Change-Id: Iddb525725591a29a61ca6b5e2ad519ab708164eb
We often use the IDestroyable interface to provide us with a standardized
way to break internal references and tear-down objects, however many
objects don't need this to be async. Once using IDestroyable, everyone
must assume that you must be async.
This change introduces IReleasable, a sibling to IDestryable, which
provides the |release| method. IReleasable is the synchronous version of
IDestroyable.
This change converts EventManager from IDestroyable to IReleasable as
the first of many conversions.
Change-Id: Ic3e90e594abc1c7326eccbe2521eb71676b74a09
In streaming engine, we would use playhead to get the current
presentation time. Playhead was provided via the player
interface (defined by streaming engine).
Since streaming engine only needed to know what the presentation
time is, this changes the player interface to require a function
to get the presentation time rather than the playhead.
The general theme of this move is to help define the interface
in terms of needs and not the means in which they are fulfilled.
Change-Id: I442d54f08b650f22b9273a191d5a3a57af37b5bf
In prep of doing some work with streaming engine, I needed to update
the test to use ES6 so that it will be easier to make the changes
needed in the tests to try out the ideas.
Issue #1157
Change-Id: I5b468a70a3514df07063c2aa3c56f1b265ce4cc6
Instead of duplicating the default configuration values in each test,
this now uses the default configuration methods.
Change-Id: Ifd2ab349db7903a2acb0d06fed4bd0ccd5050b35
Instead of requiring media source engine to create its own closed
caption parser and then allow tests to override it, have it be
passed into the constructor.
This allows us to easily use the fake one in all our tests and
removes the need for a test only method on media source engine.
Change-Id: Ia1d4f0bb988dca30699b30ccaf4522126f357f90
It seems that there is a bug in Safari where it will sometimes not fire
the 'ended' event even though it does end correctly. So this changes
to use the 'timeupdate' event instead.
Fixes: 88699186
Fixes: 113334148
Fixes: 115994183
Change-Id: I6544f0a04feed1d2478a8f65070946811b9736d0
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
This is an automated fix to be inline with Google style guides, this
was created with eslint's --fix option.
Change-Id: I860eecbc8152603e730aa17a1393f16d26b3b6fc
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: If4792c1bd3d5a82c24a4b2f0f84790d4eed22e67
This isolates MediaSource code without changing the early
initialization of MediaSource, which was designed for low-latency
startup.
Prerequisite for #1087, #880, #997, #816
Change-Id: I61acedd95d73610d3e67436d9c7767d643fe2d29
When playing manifests with segments longer than bufferBehind, while
gap jumping is enabled, there can be issues where the streaming engine
evicts the frames of the segment currently playing, thus creating a
gap that is then jumped.
This change makes the streaming engine use bufferBehind or
maxSegmentSize, whichever is larger, when choosing when to evict
segments.
It also adds a getter for maxSegmentSize on presentationTimeline.
Closes#1123
Change-Id: I83459c5eb3ebb1d6dff031e2bc244ac9fc3b5763
This digests and organizes many of the automatic settings in eslint,
and changes several of them to be more strict. This also fixes the
following errors:
- array-callback-return
- no-catch-shadow
- no-multi-spaces
- no-new
- no-throw-literal
- no-useless-call
- no-useless-concat
- no-useless-return
Several checks have been organized into a group of checks we should
use, but need more time to implement and fix. Some other checks have
been delegated to the Closure compiler, which can more precisely
whitelist exceptions.
Issue #1157
Change-Id: I8fe4966959e08050f8159e6a1fee161e7d71177e
Seeking to or starting playback at the duration does not work well
across browsers. Any seek or startup time at or past the duration of
VOD or IPR content will be bumped back by a configurable amount
(default 1s).
Closes#1014
Bug: 69874888
Change-Id: I6d21ecd8e211f0f823a093b8eb8b95d329b4385f
Some integration tests have started failing on Tizen. Without a brief
delay between tests, Tizen's pipeline gets stuck on subsequent tests.
There is media buffered, playbackRate is 1, paused is false, but the
playhead will not move.
Fixes: 64015865
Change-Id: If4497924d981e6ce1081690e02a16dc37b3dd439
When we detect stalls in the media pipeline and attempt to flush them,
we should only flush once. This avoids a situation in which a slow
hardware pipeline could trigger multiple flushes (when slowness can't
be differentiated from a stall).
Change-Id: Idd2ff8f6dd6ee64e903768b8846d8906e4db6787