Commit Graph

86 Commits

Author SHA1 Message Date
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
Joey Parrish da03f4391a Revert in-progress recording (IPR) support
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
2016-07-28 16:49:08 -07:00
Joey Parrish fb7cc53a4e Push language into Representations
Duplicate language information from StreamSet to Stream.

This will simplify the task of determining when a configuration
change triggers a language change.

Working toward a solution for #435

Change-Id: I461f7e8974f1e09b0b6f38edfab901b3f89eb3bc
2016-07-20 13:37:59 -07:00
Joey Parrish 24f8f189ef Guess contentType by checking TextEngine support
This allows us to support manifests where AdaptationSet does not
specify an explicit contentType of 'text' for Representations
containing 'application/mp4; codecs="..."' text streams.

Also makes the demo app more resilient against unexpected track types.

Change-Id: Iec46f49d1b7726bec1b8d24bd6cc6f3fd2101ab4
2016-07-19 23:03:16 +00:00
Joey Parrish b7af879583 Remove hasOutputRestrictions
If a key status is 'output-restricted', treat the key as unusable.
In many cases it is, and we have no way of differentiating when it is
or is not.  So our treatment of this status should be conservative,
and we should treat the key as unusable.  This will prevent
HDCP-related failures that may be caused by adapting to a stream whose
output restrictions may not be met.  The hasOutputRestrictions flag on
streams and tracks is now gone.

The caveat to this change is that if content is encoded with the same
key for SD and HD, and HD streams have HDCP restrictions that cannot
be met, we will now consider both the SD and HD streams to be
unplayable, even though we could still play the SD streams.  Because
we can't separate the status of the two streams, we don't know for
sure if the SD streams can be played.

We will no longer support such content due to the complexity of doing
so, and due to the risk of playback failures on adaptation to
restricted streams.  Streams with different security requirements
should always be encrypted with different keys.  Content which does
not follow this best practice will no longer be playable in Shaka
without modifying the player.

Change-Id: Ia29db8efa0b6f83c0376199dea5210c9b468bc40
2016-07-13 10:40:24 -07:00
Seth Madison ab86551814 fitSegmentReferences: live check should consider timeShiftBufferDepth
If we rely on duration != null in-progress recordings get their
last segment stretched to the end
2016-07-01 17:06:51 -04:00
Andy Hochhaus 87a62d717e Add missing goog.require() dependencies 2016-06-25 15:45:15 -07:00
Jacob Trimble a3c1ed29d4 Defer filling URI template until request is made.
Instead of filling the URI templates when parsing the manifest,
wait until the request is made to fill it.  This reduces the time
it takes to parse the manifest.

This was tested using a stream with a 24-hour timeShiftBufferDepth.
Using a Chromebook pixel running Chrome 51.  The average manifest
parse time was about 1 second before, now it is about 200ms.

Issue #405

Change-Id: I89f36085441f6c6b7d6281b24b671dc668f23fe5
2016-06-23 21:15:19 +00:00
Jacob Trimble 7aab332e9b Correctly use suggestedPresentationDelay in seek range.
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
2016-06-22 22:06:51 +00:00
Joey Parrish 792c44a792 Do not reject "application/*" streams
Otherwise, we fail to play manifests containing TTML.  Without a TTML
parser, TTML streams should be ignored and not cause failures.

Issue #111

Change-Id: I982ad04083e40a3f5c5023f0059fa4ae1604ab07
2016-06-22 20:32:40 +00:00
Jacob Trimble 6cc9613803 Add support for storing protected content offline.
Now the Storage class can store protected content and play it back.
When deleting it, the offline EME sessions will be removed.  Also
now offline support appears in Player.support().

Closes #343

Change-Id: Ic5b5a0e0854d80f7821e04e751275abf40ee6eb6
2016-06-16 18:30:25 +00:00
Timothy Drews fe9189e413 Allow Representations without Segment* elements.
Representations without Segment* elements or which do not
specify "text" as their type are now ignored instead of causing
failure.

Issue #368

Change-Id: Ica6490442dc38c7fdbc778eb0650dd7909d764c5
2016-05-25 00:18:01 +00:00
Joey Parrish b73eeb89d2 Fix support for relative paths in UTCTiming
UTCTiming and configured clock sync URIs can now be relative.

Closes #376

Change-Id: I45f2a22ec6ddea7e345f6df71ebd4195aa3981a7
2016-05-24 18:49:11 +00:00
Timothy Drews b83a9c0a27 Handle output-restricted key status.
If a key is output-restricted it may still be usable.
So, instead of disabling these tracks, indicate that they
may be playable.

Issue #199

Change-Id: Ic13a02d97ccc21533118f17aa907c16d1cda05ce
2016-05-09 15:10:31 -07:00
Joey Parrish 0a3d6bd5b8 Add an option for default clock sync URI
Applications which cannot control their manifests may need to specify
a default clock sync URI for use when UTCTiming elements are missing.

Closes #290

Change-Id: I5704b25d2d3199ceb932f8102490a9b3e8a27dac
2016-05-04 07:44:15 +00:00
Joey Parrish 2e19ebe14a Revert "Update clock sync on manifest update"
Hitting UTCTiming sources over and over could be considered abusive
behavior at scale, so we will only sync the clock once on startup.

The change to update clock sync on manifest update was added for #345,
but it seems that this was not part of the fix, since the content in
that issue had no UTCTiming element at all.

Change-Id: I32f4fc0a40fc92feeb54191e5fe869e0aaa9b54c
2016-05-04 07:44:15 +00:00
Joey Parrish 1fb78929c1 Warn when UTCTiming is missing for live
Without a UTCTiming element in the manifest, a client cannot
synchronize its clock.  This can easily lead to playback failures,
so we warn application developers when we detect this.

Issue #290

Change-Id: Idcb395f5ece67bf2c7d0d984ad277f552d030eb8
2016-05-03 18:47:55 +00:00
Joey Parrish 8ad7762a7c Fix typo that broke docs build
Change-Id: I7f12215097beb99792eaea6b9e4c2fc4de87524d
2016-05-03 18:45:26 +00:00
Timothy Drews 294bcca4e9 Treat absent timeShiftBufferDepth as infinity.
This patch also enables presentations to start in live mode
and end in VOD mode.

Issue #351

Change-Id: Idc0ad0c69887d61d080f844ef388222d1228a535
2016-05-02 14:22:38 -07:00
Joey Parrish bc17162407 Fix key system content type checks
Some browsers, such as Edge 13, do not report capabilities at all.

Not all encrypted streams have known key IDs, so we should not
use that as a predicate for the encrypted content type filter.

Since not all content has both audio and video, the requested and
reported capabilities may not have both either.  So we should
default capabilities to empty lists if missing.

This also adds an encrypted audio-only asset so that audio-only is
covered by our integration tests.

Closes #342
Closes #360

Change-Id: If5973c4ddea358d96ab305700e027021b1a7b65a
2016-05-02 18:22:52 +00:00
Timothy Drews 1108700f10 Use segment info to adjust the pres. timeline.
* 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 #341
Closes #348
Issue #357

Change-Id: I96c22774448476bea89ff4014f03b87bdb51ba07
2016-04-26 21:09:57 +00:00
Jacob Trimble f9552a5359 Update clock sync on manifest update.
Issue #345

Change-Id: I9faef800444e3b818c8da64cf71848a99713c3ff
2016-04-22 09:52:45 -07:00