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
The recent DASH refactor broke the details of multi-period segment
references for SegmentTemplate+duration.
This change introduces a corrected universal model for generating
segment references for fixed-duration SegmentTemplate content. It has
been tested with a variety of streams from third-parties, most notably
the DASH-IF's live simulator.
Issue #1339 (flatten periods)
Issue #892 (refactor StreamingEngine)
Closes#2111
Bug: 28087927
Change-Id: Ife4e9ae2bb726e24e97dfe153882dabba4c03f2d
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
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 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
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
The drift fixing allows us to play content that has drift by starting
to play at the last segment in the manifest. But some live content
specifies content in the future, so we can't just start playing at the
last segment in the manifest.
Fixes#1729
Change-Id: I3095a2d28b34ed93346933f561d77335361f1fae
Before, segment timestamps were used in PresentationTimeline without
regard for the period start. This means they were not truly relative
to the presentation, but to the period.
The "isFirstPeriod" argument was also broken. It was meant to be true
for segments from the first period *ever*, but was passed true for the
first period *in the latest manifest update*. So data calculated from
that was bogus for live streams.
Now, notifySegments() is supplied with a period start time, so that
segment references can be combined with the period start to give
presentation timestamps. This fixes a major issue with the original
fix for #999.
Closes#999
Change-Id: Id0fe450f3ce4f90a2387d7103c75eb88f0c69c72
This calculates the DASH live edge from explicit segment descriptions
when we have them. The net effect is that availabilityStartTime will
only be used with SegmentTemplate+duration, in which we have no
explicit segment times.
With this, a DASH live stream experiencing encoder drift can still be
played so long as we know the segment times. This makes playback of
DASH live streams work more like HLS live streams.
Please note that DASH live streams using SegmentTemplate+duration may
still suffer from encoder drift.
This change also:
- Avoids DASH clock sync when availabilityStartTime is not used,
which should reduce startup latency
- Removes the simulation of a presentation start time for HLS live
- Renames some variables and improves comments for clarity
- Fixes some brittle tests that made bad assumptions or instrumented
the wrong methods
- Adds new tests that show the new behavior in PresentationTimeline
Closes#999
Change-Id: I21d7f3ccc81c9d9e218857a9b41882a7609ca36a
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
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
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: Ibce58f022b79de5efd5c0f3d5ab40a6042055b3f
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
Rather than using the availability window, Playhead should use the
seek range to restrict the playhead's position.
Closes#1224
Change-Id: I8612bfafb53bbb214e32aae2d71af52d748a3aee
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 was only being used in tests which verified its own behavior. This
removes the useless method to make tests that use mock
PresentationTimeline cleaner. Code should use the availability window
methods indead of explicitly using the availability duration.
Change-Id: I0a9be8f319977ea8eb3ab50c65e458f49d9a3a75
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
HLS Live comes in two flavors: LIVE and EVENT.
EVENTs append segments to the end of the playlist, but do not
ever remove segments. LIVE can both append segments to the end
and remove segments from the beginning of the playlist.
This CL lays the ground for supporting both types and introduces
support for EVENTs.
Issue #740.
Change-Id: I2042660daf9d1e7209cb1b40f50ab8b24571faa4
This reverts commit 478fb1a473
("Detect and attempt to correct timeline sync issues") and commit
4334b6ea90 ("Add mediaSegmentReferences
to shakaExtern.Stream").
Timeline correction only addresses one class of broken live content,
while actually making it more difficult to diagnose other classes of
broken live content.
Issue #933
Change-Id: Ie71b8a45600ed0994626f53268fb90e336c3c62b
This uses the new mediaSegmentReferences field, if available, to
detect and attempt to correct common timeline sync issues. If the
most recent segment is outside the availability window, we make a
guess and move the window to align with the segments.
Closes#933
Change-Id: I1b9c444f82f9c526caf7a6942a758493d0adf9be
The bulk of the logic for gap jumping is handled in Playhead. It
tracks the current buffered ranges and jumps over any gaps that appear.
It listens for a special browser event ('waiting') for when the video
element runs out of playable frames.
This change also removes the logic for jumping gaps at the beginning
of the timeline. This is handled by the more general gap jumping
logic and works cross-browser.
Finally, this updates the buffering logic to only count the amount of
content buffered (i.e. ignoring the gaps). This fixes some bugs where
gaps in the content can result in StreamingEngine buffering forever
since it thinks only a little is buffered.
This includes full implementation of the logic, but this doesn't close
the issue since there aren't any integration tests yet. Those will
be added next.
Issue #555
Change-Id: Id99eb9fe469e8cf2c7464a3d70c3733791e806e0
This is a slightly-temporary fix that fixes#692. This will
be replaced by a refactoring of Playhead. That is also why there are
no new tests for this behavior.
We calculate a "safe window" where we could seek to if we are
unbuffered. This ensures that we don't move backward while we are
buffering and "fall" out of the availability window. Before, we would
take the availability start and add the rebuffering goal. This led
to a problem where we couldn't seek to 0 since we would truncate the
availability start to 0 before adding. This meant that even if
timeShiftBufferDepth was far enough away so that 0 was "safe", we would
still not allow seeking to it.
This makes it so we add the rebuffering goal before we truncate to 0
so time 0 can be considered "safe".
This also changes how seeks before the availability window are handled.
Before, it would always seek back to the "safe" point, even if there
was enough buffered. Now, so long as the start of the window is
buffered, we will seek to the start of the window if you seek before it.
Closes#692
Change-Id: If8fc23b4d7dd945e0e1c01dd215e998037cd4ebb
Before we would use the suggestedPresentationDelay attribute when we
determined the availability start, which is incorrect. This can be
seen by loading the DashIF live simulator streams and seeking to the
beginning of the seek range.
The DASH spec doesn't explicitly state this either way. It seems to
suggest that suggestedPresentationDelay is only used to synchronize
playback and isn't used to calculate segment times or availability.
The spec also says that clients can ignore the attribute and use their
own, which suggests that it shouldn't affect availability.
Change-Id: I44d23a556c1aa40c42e2893718f8da1d3a373e8d
These issues were identified by an upcoming release of the compiler
and must be fixed before we can upgrade.
Change-Id: I8cf3af90b930f2adfa9760299fe69f1892614bf2
Behavior for IPR streams:
* offline storage disallowed
* segment references will not be stretched to the period
* seek range starts at 0
* seek range end is calculated like the live edge
* seek bar is from 0 to duration, not the seek range
Closes#477
Change-Id: Ia36874bb7208c2473c79cb817395ce03925b8c95
This change creates a new model which divides DASH streams into VOD,
IPR, and live. It is possible to create manifests which do not fit
into any of the three categories according to our model, so we now
assert that our input fits cleanly into one of the three.
Inline manifests used in our tests had to be updated to conform to
the new model. All external test assets have been verified to fit
into these categories.
This is phase 1 of IPR support. There should be no behavior change
in this CL.
In phase 2, we will make various other parts of the library aware of
IPR so that IPR-specific behaviors can be achieved.
Issue #477
Change-Id: I395d3a0c8c9825a3cd2efde263b8493ce0920ed9
These patches and IPR support in general will be revisited when we
have a better model for how this should work.
Closes#463
Change-Id: I2c5fe372986a9af232b052c67f8e5c3ba6585cee
This allows integration tests to test Player and offline with "real"
manifests and segments that are generated using ManifestGenerator and
StreamGenerator. The networking scheme can also be used with an
unmodified Player.
b/29883614
Change-Id: I77aa5385ecaaac43ba713687befa2f064654375a
Before, we did not use suggestedPresentationDelay in the seek range.
This meant that seeking to the live edge would usually lead to a
buffering state because the seek range is the same as the availability
window. Now the seek range is handled differently from the
availability window.
b/28938315
Change-Id: Iacfffe30778f7c63734fe24eeb95634611da86be
* Permit non-zero presentation start times for VOD: some
presentations have segments which start too far from 0 to
allow the video element to begin playback; now the player will
start VOD presentations from the start of the first segment.
However, segments of the 2nd, 3rd, 4th, etc., Period of a
multi-Period presentation must still start close to 0 (the
player will not jump any gaps in the presentation).
* Prohibit seeking to regions at the beginning of the segment
availability window if segment information is missing from
that region: sometimes live manifests do not contain all the
segments in the segment availability window; now the player
will prohibit seeking to these regions.
* Update definition of live in DashParser to match Player and
Playhead.
* Simplify PresentationTimeline's constructor by just using setter
functions.
Issue #341Closes#348
Issue #357
Change-Id: I96c22774448476bea89ff4014f03b87bdb51ba07