Commit Graph

107 Commits

Author SHA1 Message Date
Jacob Trimble 310e48f8cc Fix rounding issues with multi-Period content.
Closes #882
Closes #909
Closes #911

Change-Id: Id31567137860b6bd683169b5b68ca83d6f14473d
2017-07-05 16:57:42 -07:00
Jacob Trimble adb8da4764 Disallow unknown properties (1/5).
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
2017-06-27 19:43:00 +00:00
Michelle Zhuo f09999aa80 Add channel count information for HLS audio tracks
Adding the count of channels, as a new field for tracks and streams.
Used for HLS audio tracks.

Resolves #826.

Change-Id: I1448b4a8cfaf6dd798670bb2f0f3981d6c7e40c3
2017-06-22 11:34:36 -07:00
Joey Parrish 98f3f3e218 Support MIME and codecs on different DASH elements
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
2017-06-15 11:03:46 -07:00
Sandra Lokshina c6c6d05810 Move text-related files into their own directory.
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
2017-06-06 18:21:09 +00:00
Michelle Zhuo afb0ded49c Expose Roles of Audio Tracks
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
2017-05-26 13:51:43 -07:00
Theodore Abshire 1e119e40cf Adds option to fail gracefully on xlink failure.
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
2017-05-25 21:10:09 +00:00
iKinnrot 151930284a Add support for DASH label and HLS NAME attributes (#811)
* add support for non-standard DASH label attribute
* add support for HLS NAME attribute

Closes #825
2017-05-25 10:43:07 -07:00
Theodore Abshire 723e6ad1bc Added basic xlink support.
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
2017-05-08 14:00:56 -07:00
Joey Parrish 0371210a14 Clarify DASH minimumUpdatePeriod
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
2017-04-24 09:35:43 -07:00
Theodore Abshire 5985dced7c Added another XML parsing validity check.
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
2017-04-17 20:41:43 +00:00
Sandra Lokshina b14867bc65 Add config to ignore key system and init data in DASH manifest.
Closes #750.

Change-Id: I551a671eb153428f7d9a7900bf9b47cb37694f95
2017-04-17 17:22:37 +00:00
Jacob Trimble 72c61ed785 Handle gaps between Periods.
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
2017-04-05 18:45:58 +00:00
Jacob Trimble 575f2ad109 Add an indicator for critical errors.
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
2017-04-04 23:57:59 +00:00
Jacob Trimble b4d0fa4901 Expose license expiration times through Player.
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
2017-04-03 18:25:43 +00:00
Jacob Trimble ca2f61d6bc Add support for 'emsg' based manifest updates.
b/36072752

Change-Id: I00c19be71e81b15b5d3f33d5e2dafb17a6f8acee
2017-03-16 18:46:05 +00:00
Jacob Trimble d51079516e Fit segments to Period for live content.
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
2017-03-09 21:03:23 +00:00
Jacob Trimble fc46b29ed8 Move 'emsg' handling to StreamingEngine.
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
2017-02-23 19:36:06 +00:00
Sandra Lokshina eff3225563 Add constants for shaka content types and stream kinds.
Change-Id: I6630863e3a53caf9c863e5df6a593cddba516f2a
2017-02-17 09:59:37 -08:00
Sanborn Hilland c39e405654 Don't ignore InbandEventStreams at the Representation level (#687)
Closes #686
2017-02-10 15:12:40 -08:00
Sandra Lokshina 24c17d2d44 Implement basic HLS manifest parser.
Issue #279.

Change-Id: Iec504a7f180f6f069d08bea471a7d4970f7ae7d4
2017-02-09 21:04:50 +00:00
Jacob Trimble 75acdde2e1 Add warning about not supporting the indexRange attribute.
Change-Id: Id97a1b7a57bc4ae0c74130ea09d1ff937222bd5d
2017-02-06 20:50:37 +00:00
Jacob Trimble 79ea0f0854 Update documentation for Tracks.
Closes #679

Change-Id: I7a7fa6534f328a79fdce2b7b8cd6cd60fec210fc
2017-02-03 22:50:49 +00:00
Joey Parrish 8ba088a38f Generate externs automatically
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
2017-02-01 11:42:16 -08:00
Jacob Trimble b445e46f75 Add error for duplicate Representation IDs.
See https://goo.gl/BAM3mi

Change-Id: Iea49b78ecd299e992b60f3776ec5360c15d2cb62
2017-01-30 21:06:24 +00:00
Theodore Abshire 354880c32e Fixed the keyIds field in drmInfo.
Now it is set in a more suitable stage of content parsing, thus
fixing a bug where the field would contain multiple copies of
every keyInfo.

Change-Id: I12875efa04c4e3ccbb459945091533006bd398fd
2017-01-30 20:25:14 +00:00
Jacob Trimble 68e870dc9a Add support for EventStream elements in DASH.
This also makes the Playhead ignore duplicate regions.  This simplifies
manifest updates in DashParser by having it add every Event tag it
sees.  The DASH spec doesn't specify how we should detect duplicate
entries or how events are fired.  So to avoid firing all the same
'timelineregionadded' events on every manifest update and getting
multiple enter/exit events, we will simply remove duplicates.

Closes #462

Change-Id: If5d2c42bd6958567b2ec05ba1e9af252c95cf354
2017-01-26 21:56:07 +00:00
Jacob Trimble 87c7d5d665 Add framework for events on the media timeline.
This add the groundwork for event regions that occur while playing.
When the playhead enters (or plays through) a specified region it will
fire enter/exit events for it.  They are not fired when seeking over.

Issue #462

Change-Id: I9e280796bd012ad74d0319aa2056c6f6aa28890d
2017-01-20 22:19:33 +00:00
Sandra Lokshina 87073c9afa Create ManifestParserUtil common to dash and hls parsers.
Both DASH and HLS parsers will be using resolveUris() and possibly
other methods in the future.
Create a ManifestParserUtil for the shared methods.

Issue #279.

Change-Id: Iaa5e32ec543a390341a54752563a9f27251f0832
2017-01-19 23:34:25 +00:00
Jacob Trimble 2ca962a33c Refactor ManifestParser.start to accept an object.
Rather than accepting multiple callback methods as separate arguments,
now start() will accept an object.  This will allow us to add new
callbacks without breaking backwards compatibility or adding
additional arguments.

Change-Id: I839cbb12e71c2e7270aa218802c79440c458e964
2017-01-19 22:54:09 +00:00
Theodore Abshire 8b2212c65d Enabled asynchronous response filters.
Also updated externs.

Issue #610

Change-Id: I4c9539442d6fb77781296ea1acf123b3653e3b40
2017-01-09 17:34:22 +00:00
Joey Parrish fc7d04c0cc Skip parents with unrecognized EssentialProperty
Any EssentialProperty element we don't recognize is necessarily
attached to something we don't know how to handle correctly.  We are
now following the recommendations in the specs which say that the
parent element should be skipped in these cases.

Change-Id: Iabd8a796c6c27e4187b3f0d7efe60ea35c933c7e
2017-01-05 21:17:13 +00:00
Joey Parrish c6451690e6 DASH trick mode support
Parses DASH trick mode tracks and puts the extra trick mode Stream
into the manifest.  StreamingEngine can now use this info to optimize
streaming during trick play mode.

Includes:
 - a new demo asset with a trick mode track
 - updates to tests (we now require at least one audio or video stream
   and we require bandwidth attributes on them)
 - updates to the parser's trickmode test
 - a new StreamingEngine test

Closes #538

Change-Id: Id38264ca64bc7905a5c33a269269741cfd12dd4d
2017-01-05 04:45:10 +00:00
Joey Parrish b4cfc1fa72 Drop DASH AdaptationSetSwitching support
These properties are no longer used since we refactored for variants.
All compatible AdaptationSets are now implicitly squashed together.

Issue #279

Change-Id: Idc1922c54b0c1aa62f3199369b8e819e3a374b55
2017-01-03 17:44:59 +00:00
Sandra Lokshina e95d7b9de4 Refactor shaka internals to use variants instead of stream sets.
Issue #279

Change-Id: Idf4241b4e2490876bdc6275685361a5c9bf132b0
2016-12-28 17:49:24 +00:00
Joey Parrish 7dc98a7d6b Fix DASH content type parsing
The DASH parser was not always correctly deducing the content type.

For unspecified content types, the type can be deduced from the MIME
type.  For example, video/mp4 is video, and audio/webm is audio.

For text, things are a little more complicated.  Text types do not
always start with text/.  In particular, embedded text, such as VTT
in MP4, have a MIME type that starts with application/mp4.

To deal with that, if we see an unknown type, we ask TextEngine if it
supports it.  If so, we deduce that the content type should be text.

This check against TextEngine was only happening for MIME types
specified on the Representation, but not on AdaptationSet.  This
replaces a weaker deduction in the general frame parser with the same
TextEngine check we were using elsewhere.

Furthermore, Player mishandled the content types it passed to
AbrManager.  AbrManager will only choose audio, video, and text
streams.  It ignores all other types.  Player, meanwhile, threw a
confusing error if AbrManager failed to choose some of the types
passed to it.  Therefore, Player should only pass audio, video, and
text types to AbrManager.

This fixes both issues and adds new unit tests for both.

Closes #631

Change-Id: Ib1311d37d00c3989367fd066f66e1eba85652e40
2016-12-14 22:10:14 +00:00
Joey Parrish e6a6e980cb Throw explicit error on empty manifests
Before this, an empty manifest (no periods) would result in a
TypeError from the containsInband computation.  This corrects the
computation and introduces an explicit error for empty manifests.

Closes #618

Change-Id: Ie9b740dbfa4ffcafbf99541bf03fa68cfae2bf88
2016-12-05 15:16:46 -08:00
Joey Parrish 18da8e04dc Export all plugins
This exports all plugins from the library, to make delegating and
subclassing easier for applications.

This also fixes a couple of issues with the generated documentation.

Closes #551

Change-Id: I23798f6117e1944d7ffc67bcb50ae36f3943710a
2016-11-14 23:58:09 +00:00
Joey Parrish 5b6780bf39 Move filter and scheme plugin types to shakaExtern
If an external project wants to reference the filter or scheme plugin
typedefs, these should be in shakaExtern.

Change-Id: I7bf70d2efbf741c8b07a7b8502b3f52eff49dd9d
2016-11-04 17:12:16 +00:00
Joey Parrish 696332fbf8 Fix AdaptationSetSwitching support
We had a typo in the case of an attribute (schemeIdUri vs schemeIdURI)
and we did not have support for the latest scheme URI (upcoming MPEG
scheme URI vs /guidelines/ vs /descriptor/).

Change-Id: Ibee1802cfe2b04183d52e75378fa23e0c4e3aae8
2016-10-11 02:31:50 +00:00
Joey Parrish ddfb30a281 Ignore trick mode tracks
Issue #538

Change-Id: I47393ccdc189cf55b90e3a8e4239541e817618f9
2016-10-07 10:39:55 -07:00
Jonas Birmé a060050564 Provide framerate and codecs information on video tracks (#533)
Closes #516
2016-09-28 14:13:54 -07:00
Joey Parrish 5389501197 Improve live edge startup
This fixes the definition of start time to exclude the rebuffering
goal. It also gives us a more conservative default presentation delay.
Content providers should always strive to provide a presentation delay
for their live streams.

Closes #504

Change-Id: I5a373666f4e325cc056ab2336d236b207430bde6
2016-09-03 10:48:03 -07:00
Sandra Lokshina 925338f2b7 Add support for multiple roles to DASH parser.
DASH parser used to assume representation can only have one role.
However that's not true in case of text representations that can
have both role=main and role=caption/subtitle.

Closes #500

Change-Id: I1b6a494347a0b86211b6982416e444c020b1eeb0
2016-08-29 21:34:16 +00:00
Joey Parrish 3cad924cf1 In-progress recording (IPR) support, phase 2
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
2016-08-29 19:57:15 +00:00
Joey Parrish eafe954d0c Replace Number.POSITIVE_INFINITY with Infinity
This is supported on all browsers, is more compact, and is easier to
read.

Change-Id: I96576dc341e093b7be9ef94fe36595c945b063c1
2016-08-29 18:56:54 +00:00
Joey Parrish c7e73e0115 In-progress recording (IPR) support, phase 1
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
2016-08-29 11:09:45 -07:00
Joey Parrish e4e200388c Fix encoding issues with Chinese subs
In many places we tried to guess the encoding of a piece of text.
This guess fails for Chinese UTF-8 text, and probably text in many
other languages.

However, DASH manifests, TTML files, WebVTT files, and VTTC box
payloads are all specified to be in UTF-8.  Rather than guess and
possibly fail, treat all text in these contexts as UTF-8.

Change-Id: I00c652a9f1dd20855e94abfac84275e41dd9e266
2016-08-25 22:29:37 +00:00
Sandra Lokshina f5f4473b3e Account for flags and version when parsing an EMSG box.
Added version and flag bytes to the test code.
Added the code to skip version and flag bytes when
parsing an EMSG box.

Closes #259.

Change-Id: Iac94785f747ec6ffb640c5b4f803e68e0c7b27cb
2016-08-09 16:57:11 +00:00
Sandra Lokshina f1a4e25151 Add support for EMSG box.
Look for EMSG boxes in segments if the manifest signals their presence.
Update the manifest when a DASH EMSG box is encountered.
Dispatch an event with the content of the box for all other EMSG boxes.

Closes #259

Change-Id: I874121207c2419e756980ac858fba0d56e68e07e
2016-08-01 14:32:23 -07:00