We were not previously applying presentationTimeOffset in
SegmentTemplate w/ the duration attribute. This fixes the DASH parser
to correctly apply the offset in this case.
This also fixes an issue in which segment times could stretch past the
end of the period or even past the end of the presentation, causing
StreamingEngine to fail period transitions afterward.
Closes#1164Closes#1163 (PR to address 1164)
Change-Id: Ib16fc2b65117557a4ad9a05adc4a07f8bc90fd3c
We shouldn't use the sum of Period durations to detect the duration of
live streams. It is possible for Periods to be added or the duration
to change, so the sum of Period durations is only valid for VOD.
Closes#1148
Change-Id: I53846807d18b97b0127eb75bb83be526eb7095ee
This change enables an additional conformance check in the compiler
which prevents us from committing code where the compiler fails to
infer what "this" means.
None of these changes constituted actual bugs, just inference failures
in the compiler.
Issue #1130
Change-Id: If9b18203768e197258042a9b4339530f371ed831
According to the DASH spec, the timescale in the manifest need not match the
timescale in the media. Therefore, we should be applying scaled
presentationTimeOffsets in segment index parsers, since the two scales might
differ.
Issue #1098
Change-Id: Ic191d1bba399b30a656ab5060d7bb226e659b79a
If the parser is failing to load a manifest, perhaps due to being offline,
and the player is destroyed mid-load, it will wait for all of the retries to
run out before canceling. This causes a significant wait time on destroy.
This change adds an optional isCanceled callback to the request method in
NetworkingEngine, allowing requests to be made that can be canceled via a
provided callback. This is then used to quickly skip past all of the
retries, when destroying the parser.
This doesn't stop any backoff in progress, so there still might be a delay of
a second or two (depending on networking settings, of course) if you destroy
during a backoff period. That will be changed in a followup CL.
Issue #1084
Change-Id: I0b99616ed4d5be078161122532ea271e84613170
In DASH SegmentBase, we were not dividing presentationTimeOffset by
the timescale. In all other instances of presentationTimeOffset in
DASH, we were handling it correctly.
This bug was present in all v2 releases until now.
The solution is not only to divide by timescale, but to rename all
internal uses of presentationTimeOffset to either unscaled or scaled,
to differentiate between those in timescale units and those in
seconds. I believe inconsistent naming and units were a contributing
factor to the creation of the bug.
Closes#1099
Change-Id: Id561f8eb1f5bc011c606e1925c12f0d8183fd51a
Some platforms (such as Chromecast) support extra MIME parameters like
framerate, bitrate, width, height, and channels. Since other
platforms will ignore these extra parameters, we should always query
using these parameters.
This introduces the framework to construct these "extended" MIME types
from Stream objects. Extra parameters for other platforms can easily
be added later.
Change-Id: I8936ca93e84068da18f12127fbc8fc1a0646695a
The isEqualFunc and isNotEqualFunc methods in shaka.util.Functional
are no longer needed.
This removes the last two calls to isNotEqualFunc. There were no
calls to isEqualFunc. Both utility methods can now be dropped.
Change-Id: I9d4de215527982951e84162947ad9b17831eaf44
This fixes a bug in which we did not track DASH period IDs during the
initial manifest parse, which led to duplication of all periods during
the first update.
Closes#963
Change-Id: Ife9be7e5f5e158a565b0095d7cbb81b50c681422
Previously "UNPLAYABLE_PERIOD" exception is thrown when a browser
doesn't support the container or codecs in a piece of content, which is
confusing to developers and customers.
Changing it to "CONTENT_NOT_SUPPORTED_BY_BROWSER" exception.
Test manifest:
https://media-ci.foxford.ru/dist/hls-issue/issue.master.m3u8Closes#868.
Change-Id: Ied135b687190919abbeb1561c2bff36a7203136e
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 will allow us, in many cases, to detect time sync issues in
content by comparing the media segment references to the presentation
timeline. If the references are outside the timeline, it may indicate
a common form of bad content, and we may be able to attempt to correct
it.
In some cases, the references are not available upfront. We can't
detect time sync issues in DASH with SegmentTemplate+duration, because
the references are not explicitly described by the manifest. We can't
detect time sync issues in DASH with SegmentBase, because the segment
index requires additional fetching and parsing. (SegmentBase is not
used with live content, so this should be a non-issue.)
This only introduces the new data, but does not use it for detection
or correction yet.
Issue #933
Change-Id: If70b1bdbd3b08a7c8b7ae296da209737492dfe17
Although bandwidth is a required attribute in DASH and a bandwidth
value of 0 makes no sense, we can tolerate such content in many cases
and play it regardless. This used to work in v2.0.x, but stopped
working in v2.1.0 through v2.1.5.
Closes#938Closes#940
Change-Id: I0c9b8eba923971f00946282cd8c138f68827961f
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
Adding the count of channels, as a new field for tracks and streams.
Used for HLS audio tracks.
Resolves#826.
Change-Id: I1448b4a8cfaf6dd798670bb2f0f3981d6c7e40c3
This fixes the detection of content type for text AdaptationSets which
contain mimeType only, but contain a Representation with codecs only.
Closes#875
Change-Id: Ibae7ae8357653c1960daefa4c3e122187de51bb3
This change creates a lib/text directory and moves all files
with text-related logic to it. It also lays the ground for
separating text parsing and display logic. (That change will
introduce even more files with text-related logic which will
crowd lib/media directory).
Issue #796.
Change-Id: I65ac134020a0126ff02a8f2067beb73870232e65
This change is to expose an audio track's role in order to differentiate
among a main / caption / commentary track that shares the same
language.
Issue #767.
Change-Id: I05d38cba2170d0005611cf160b7ae45996fe77dd
At the moment, when there is an xlink problem, the manifest parser
returns a rejected promise. This adds a configuration variable to
instead simply not replace the xml tag.
Closes#788
Change-Id: Iace953233c83a57820130033150e7cd9a9385d6f
Before, if a relative xlink contained another relative xlink,
the nested xlink link would resolve its URI based on the filename
of the parent link, rather than its final URI.
Change-Id: Ic42ad8bfbd8487b4d1da66d86117823800c447be
Element.children does not work on IE or Edge, so all uses of it
were refactored to use .childNodes instead.
In addition, Element.children was added to the ban list, to prevent
further problems like this in the future.
Closes#792
Change-Id: I33009f77dbb1f4afa9847e31b57fda324baba472
This adds a utility to mpd_utils.js that filters a manifest and
automatically downloads and substitutes in the contents of any xlink
link.
This only supports xlink:actuate="onLoad"; "onRequest" would require
significant changes to our manifest processing pipeline.
It also adds a new field to INVALID_XML errors to indicate which
xml was invalid, to make the error more informative when called on
xml loaded by xlink links.
Also added a demo asset.
This is just a simple modification of heliocentrism to break it into
multiple files.
Closes#587
Change-Id: If87b1e78e65261dcc4e043b0c2e6cf69c1b12e08
A missing minimumUpdatePeriod should mean "do not update" or "only
update via emsg box". Internally, this is represented by -1.
A minimumUpdatePeriod of zero will be clamped to our internal limit,
which is 3 seconds.
This adds comments and new tests to cover these scenarios.
Change-Id: Ic1e74e0edf3a5f7bf5aed21c7740dbd33eab84ac
Different browsers implementations of DOMParser handle invalid XML in
different ways. In some cases, instead of the DOMParser erroring it
just inserts a <parsererror> element into the resulting xml tree.
This change detects if there was a typo deeper in the manifest, such
that the outer MPD tags are intact.
Change-Id: I9b11b0762d073b8e54129cddd5f3477039f2cb39
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
Now the DASH parser will remove gaps that appear between Periods.
It removes the gaps by adjusting the duration of the previous Period
to fill the gap. Because it affects the duration, the last segment of
the Period will also be adjusted. This only affects the segment index;
if this adjustment results in gaps in the media, they will not be
jumped (yet).
Issue #555
Change-Id: Idd2cd7ad960855be01565615c8917f7191b29503
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 method on Player to get the license expiration times for
the current EME sessions. This also adds the expiration times to the
stored content structure for offline content. This will update the
stored expiration while playing content (e.g. license duration changes
when playback starts).
Closes#727
Change-Id: I18770a79413423695bbb2ed5f31f6b19038a33d2
This change enables HLS parser to get DRM information
from the manifest and create DrmInfo objects.
Note that until we actually add support for any of the
drm systems, we will still reject encrypted content.
Issue #279.
Change-Id: I4d0652411a567bc75d919c5bf732f20e870a5aeb
This fixes an infinite loop when storing SegmentTemplate-based VOD
content. In shaka.offline.Storage.prototype.createStream_, we loop
over all segment references to feed the download manager. Those
references should stop at the period duration.
Closes#739
Change-Id: Ia16e89968b3bd8fc554b71ac857f8d9ae890cde1
The presentationTimeOffset attribute is used to adjust the start time
of segments to the DASH timeline. For example, if the first segment
starts at 10s, then this attribute can be used to make it start at 0.
Normally, the times in the manifest should match the times in the
segments. So we should use PTO on the times in the manifest.
However, for SegmentList with duration we shouldn't actually use it.
According to DASH sec. 7.2.1, the MPD start time (which is approximately
the presentation time) is after PTO is applied. In sec. 5.3.9.5.3,
when using the duration attribute, the MPD start time is calculated
from the duration (as we do). So that time already has PTO applied.
Change-Id: I8ac3befec8a8b0cbe8dda48f5c5888e1122c5d62
We usually fit segment references to the Period for VOD content. This
ensures that a gap in the manifest at the end of the Period doesn't
cause problems. We don't do this for live because we may get more
segments. However, for multi-Period live, we should still fit the
references for all Periods except the last one.
This also removes the error about duplicate Representation IDs for
VOD content since the problem only occurs for live.
Issue #694
b/35849085
Change-Id: Ib195dc51982ca58b8d5613b37817216980b8d366
Rather than having it in the DashParser as a network response filter,
we should have it in StreamingEngine. This will give it access to the
segment times so we can calculate the presentation times for the event.
Otherwise, there is no way to know when the event should actually occur
since the app can't know which segment is being downloaded or which it
came from.
This also adds startTime and endTime fields to the event so the app
doesn't have to calculate them. For reverse compatibility, the old
fields will still exist.
Closes#698
Change-Id: Icbaf3619aedfca7ea06bc8b1fe49e9cce65b0cc2
Fix incorrect timeReplacement when large timescale
The current code essentially does this
timeReplacement =
(startTime / timescale + presentationTimeOffset) * timescale
When timescale is large enough (e.g. 10 MHz in order to support MS
Smooth Streaming as well), "startTime / timescale * timescale" may not
always be exactly "startTime" because of floating point precision,
which could produce incorrect segment URLs.
Keep startTime and presentationTimeOffset unchanged in the timeline
just to avoid the multiply/divide dance.
Closes#690
Adds a new field to initDataOverride, key Id, that contains the
default key Id corresponding to this initData. This is used to filter
initDatas by their key Ids, hopefully cutting down on unnecessary
license requests.
Closes#580
Change-Id: Ie228d6c0f4c693b19b4119ec4f72a85d555215c1
We were not able to get our externs generated by the Closure compiler.
There were many issues with the Closure-generated externs, including
the order of the externs and the replacement of record types and enums
with their underlying types.
We made a few attempts to patch the compiler, but could not get our
patches accepted upstream.
This change introduces a new script to generate our externs from
scratch. It uses a JavaScript parser called 'esprima'.
Some interfaces need to be exported to the generated externs, but are
not actually attached to the namespace by the compiler. For this, we
introduce a new annotation. These are the currently-supported export
annotations:
- @export: truly exported (attached to namespace) by the compiler
- @expose: truly exposed (not renamed) by the compiler
- @exportDoc: considered part of the exports in the docs
- @exportInterface: considered part of the exports in generated externs
These annotations are now documented in docs/design/export.md
Change-Id: I33bf7384889c14c9edb0fa5f11caa7c4f4d79af6