Commit Graph

680 Commits

Author SHA1 Message Date
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 56ebf6286c Drop WRONG_KEYS
For content without a clear lead, the order of 'waitingforkey' and
'keystatuseschange' is inconsistent and causes false positives for the
WRONG_KEYS error.  Without an obvious inverse for 'waitingforkey', we
will have to drop the WRONG_KEYS diagnostic error.

See also: w3c/encrypted-media#284

Change-Id: Icc1c420ff5d177a0329db244a6b28e99820a5221
2016-07-27 15:18:24 -07:00
Jacob Trimble ee0959315c Use buffer end to determine which segments to download.
Before, when we adapt we tell StreamingEngine we are in an unbuffered
state.  This causes it to download segments at the playhead, even
though we have some buffered.  Normally this does not cause problems,
but on Edge, it can cause skipping.  So now, StreamingEngine will
use buffer end to determine which segments to download.

Issue #446

Change-Id: Ib1f4cd3a1627efa957825eb0445c99f753f31e7b
2016-07-27 17:30:59 +00:00
Sandra Lokshina 1d0e9f1f6d Add unit tests and test assets for the WebmSegmentIndexParser.
Change-Id: I9bef290722906aa77c090d9511be4d40540e9366
2016-07-27 17:25:22 +00:00
Joey Parrish 022226cc3a Merge pull request #461 from baconz/master
Consider empty text cues buffered
2016-07-25 17:16:45 -07:00
Seth Madison 89e3548074 Consider empty text cues buffered
Empty WebVTT cues are valid, and should still be considered buffered.
By using a cues object with 0 length as a proxy to the init segment,
we lose valid empty WebVTT segments. Instead, use existence of start/end
as a proxy to init segments.

This regression was introduced in ab64c76ee9
2016-07-25 16:53:58 -07:00
Joey Parrish 1c4d7bbd85 Improve HDCP error handling
* Suppress WRONG_KEYS errors when output is restricted.  This is a
   false alarm in these cases anyway.
 * Throw a restriction error when the ABR manager fails to choose
   streams for some content types.
 * Rename ALL_STREAMS_RESTRICTED to RESTRICTIONS_CANNOT_BE_MET to
   reflect the way restrictions actually work.  We cannot play if all
   streams of any one type are restricted, not just all streams in the
   period.  (e.g., all video restricted is a failure, even if audio is
   still playable.)

b/30290503

Change-Id: I6de48950d33f241b7df1161052d60b89f962649f
2016-07-25 16:33:08 -07:00
Joey Parrish c6ea804e2a Closure cleanup
* Drop unnecessary type alternation in SegmentIndex unit tests
 * Drop unnecessary bind in StreamingEngine unit tests
 * Drop unnecessary expose annotations in Pssh
 * Add comments about quoted access in cast unit tests
 * Move afterAll() position in cast unit tests
 * Make return type for PublicPromise constructor more specific
 * Define a type for Util.eventLoop return value

Related to PR #421

Change-Id: I092a8ff366b4ac4ea868dd3f4fbe4e3d63a2167f
2016-07-24 16:33:28 -07:00
Joey Parrish 9576c5b2cb Rename MediaKeys polyfills
Newer closure compilers do not seem to recognize the MediaKeys
polyfill classes namespaces because they don't follow normal
conventions.  This leads to errors about missing requires.

This renames the classes as follows:

  PatchedMediaKeys.nop       => PatchedMediaKeysNop
  PatchedMediaKeys.v01b      => PatchedMediaKeysWebkit
  PatchedMediaKeys.v20140218 => PatchedMediaKeysMs

The new names follow normal conventions and refer to the polyfills by
the prefix of the old API rather than by the version number.

This should help us upgrade to a newer compiler.

Closes #456

Change-Id: I5491ecb9a61e2b456ba8fa81a6adb6c110c96817
2016-07-24 16:27:40 -07:00
Joey Parrish 4ccaf23b53 Merge pull request #458 from hochhaus/annotations
Fix JSDoc annotations
2016-07-24 16:21:24 -07:00
Joey Parrish 3715c9a435 Merge pull request #459 from hochhaus/nontrivial_return
Add JSDoc to functions with non-trivial return values
2016-07-24 11:32:37 -07:00
Andy Hochhaus 69ad05a63c Fix JSDoc annotations 2016-07-24 11:23:56 -07:00
Andy Hochhaus 2381e27406 Add JSDoc to functions with non-trivial return values 2016-07-23 23:35:51 -07:00
Andy Hochhaus 6a00ee8a31 Add missing goog.require 2016-07-23 14:42:38 -07:00
Joey Parrish 8456b93f96 Overhaul chooseStreams in Player
* Instead of filtering the output of AbrManager, ask AbrManager only
   to choose streams for certain types.  This keeps AbrManager's info
   synced with reality.
 * Simplify the way we apply config changes, restrictions, and new
   text tracks to one method.  Detect which types need updates and
   only ask for those streams from AbrManager.

Issue #435

Change-Id: Ie10ddd2805cd45e97594838520e677de628a9f4c
2016-07-22 16:15:53 -07:00
Joey Parrish 9eadb61b4a Allow redundant switches from AbrManager
Working toward a solution for #435

Change-Id: I662c06c21eab7c5b6f2af85236088f1712ee7a72
2016-07-22 14:42:20 -07:00
Joey Parrish e66a2d5163 Sync export annotations with uncompiled requires
Make sure all interfaces required by external plugins are exported
and goog.required.

Change-Id: I16066c4086907f970ace9e297d30c5e82504514d
2016-07-22 21:39:50 +00:00
Sandra Lokshina fcb4df53ca Refactor Mp4SegmentIndexParser and add unit tests and a test asset for it.
Change-Id: I216d389fa53d8f6aa1ffdd1111bdcd965ce1732f
2016-07-20 22:14:55 +00: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 10fd95760c Take partial StreamSet list in AbrManager
This will allow us to pass only audio stream sets when a language
changes, which will remove the need to filter the output of
chooseStreams in Player.applyConfig_.

Working toward a solution for #435

Change-Id: I893d13882809ef461b16c6c9426c8e9e33604c02
2016-07-20 13:37:53 -07:00
Joey Parrish a37f49a623 Clean up bogus comments about AbrManager
Calling chooseStreams does not disable AbrManager.
Further, we must explicitly disable it when switching periods.

Cleanup for issue #435

Change-Id: Ib5c75ddabb342929aef31eb185860b08d5c27cdc
2016-07-19 16:03:38 -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 ab64c76ee9 Fix MP4 text parser integration
* removes an assertion which is no longer valid
 * corrects the registration of the VTT in MP4 parser
 * fixes some type issues in TextEngine

Change-Id: I0b7f41f01e5d7be2932c86a56f3cdfd6a53d04cb
2016-07-19 23:03:16 +00:00
Sandra Lokshina 7b6a140512 Refactor lib/util/pssh.js to use Mp4Parser
Change-Id: Ib6d5668f21596a87b388258059fa09b4987fd25a
2016-07-19 22:54:31 +00:00
Seth Madison 29c9fa9fec playhead reposition: treat anything with a duration as vod
If there is a duration set the start of the window will not move.
2016-07-19 15:09:55 -07:00
Joey Parrish 74de6f1159 Update track and adaptation docs
Closes #447

Change-Id: I4aa83d0900feb4dea14f0e7f87287038d2d60a08
2016-07-19 17:16:28 +00:00
Joey Parrish bf544fd4c9 Defer DRM events, redesign DRM errors
Wait to send a WRONG_KEYS error until key statuses have propagated.

Also, check for expired keys and fire the EXPIRED error from the key
status handler, not from 'waitingforkeys', which is not yet available
everywhere.  The EXPIRED error will suppress any WRONG_KEYS error that
might otherwise fire when 'waitingforkeys' happens.

Finally, do not trigger track restrictions based on expired keys.  This
means EXPIRED will never be followed by ALL_TRACKS_RESTRICTED.

This provides more deterministic behavior in tests and clearer
diagnostic signals for app developers.

Change-Id: Idd0f91fdd6442125661b9593ecaad0b57b81625c
2016-07-19 17:16:13 +00:00
Sandra Lokshina 8b767df6a1 Implement parsing for WebVTT subtitles embedded in mp4.
Closes #277

Change-Id: If74bb81b66a78939b4f87e4f9f793328d50ed069
2016-07-18 23:52:56 +00:00
Sandra Lokshina 259777fe9f Implement parser for segmented TTML in MP4
Closes issue #278

Change-Id: I2f454a2c2f63d8ce6682cd4593c1d843b2967978
2016-07-13 21:49:43 +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
Jacob Trimble 858d3a55c7 Give warning when storing tracks of the same type.
When storing multiple tracks with the same type/kind/language, issue
a warning, since adaptation does not make much sense when playing
stored content.

Change-Id: I75d1625b2de680ae06728862d27b50272b951b7f
2016-07-13 16:16:04 +00:00
Joey Parrish 6daa7f3b83 Allow AbrManager to clear ahead of the playhead
SimpleAbrManager will now leave 5s of video ahead of the playhead and
clear the rest when upgrading to a higher resolution.

Also smooths transitions for overlapping segments by scheduling an
abort() call to reset MediaSource internals after removing content or
changing the append window.

Related to issue #435

Change-Id: Ie036515388e1e7e4b3b8f3ab9922e3d5e7ed2627
2016-07-13 04:01:11 +00:00
Jacob Trimble 28aac020a6 Add test networking scheme.
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
2016-07-12 21:52:36 +00:00
Joey Parrish 4c1d299539 Merge pull request #441 from baconz/fix_in_progress_seek_end
change getSeekRangeEnd to allow scrubbing to end of in-progress VOD
2016-07-12 14:50:11 -07:00
Jacob Trimble d17c9ddf22 Download different content types in parallel when storing.
Change-Id: Id66a6de7953e4c9678bbd39837d8b89601a43f8b
2016-07-11 16:10:44 -07:00
Seth Madison 30ef66eea2 change getSeekRangeEnd to allow scrubbing to end of in-progress VOD 2016-07-11 16:03:19 -07:00
Sandra Lokshina 7e9bd79653 Add position, line and size settings parsing to the TTML parser.
Issue #111.

Change-Id: Ieeafda794b54ae2aad6751eadba28e28882d6b49
2016-07-11 21:33:20 +00:00
Jacob Trimble 2c3dccc45e Fix bug with text engine buffered ranges.
Based on pull request by @baconz.  Before, when appending segments,
TextEngine was given the segment times and then added the timestamp
offset to get the real time.  However, this is incorrect as we want
the time relative to the presentation timeline.  So we should only be
adding the period start time (the timestamp offset also includes PTO).

Closes #411

Change-Id: I92582d1cda034daef5e8ce2d7b79deafa0ddf828
2016-07-08 16:21:23 -07:00
Timothy Drews bf20f4ad2a Clamp getSeekRangeEnd() if necessary.
Change-Id: Ie6f3e43fbe84fe0c6fe21d9ef44dc92695a04dfd
2016-07-08 16:56:00 +00:00
Sandra Lokshina 134119ecfa Add new time formats and refactor time parsing logic for TTML parser.
Issue #111

Change-Id: Ia9ebcd9be19ebdc452d9554ace116265d5a7d59c
2016-07-07 13:07:02 -07:00
Joey Parrish 3def38190e Cleanup cast idle state
This simplifies the logic for idle state, fixes some buggy idle state
transitions, and moves the idle logic into CastReceiver (with a little
support from Player).

Issue #261

Change-Id: Ic2729a4235c746ad46353bdf5dc7b605ab31f3ef
2016-07-07 19:29:07 +00:00
Joey Parrish b2fd1406c1 Fix race between Cast sender and receiver
The sender is always polling video.buffered in the controls.  Before
the first update from the receiver, the sender should see local values
for video.buffered.  However, the receiver was updating volume events
before the first full update, leading the sender to try to access
remote values for video.buffered before they existed.  This caused
uncaught TypeErrors in the controls.

Issue #261

Change-Id: I3836315d136be4584c1140842720919bca5d57e2
2016-07-07 19:28:56 +00:00
Joey Parrish 3624d8e079 Limit Chromecast playback to 1080p
Original Chromecast devices can output a max of 1080p, and may have
issues digesting higher resolution content.  Since higher resolution
content would be downscaled for display anyway, limit Chromecast to
1080p to avoid both decoder issues and wasted bandwidth.

Some Cast devices may support UHD content, but the max res for
Chromecast is currently hard-coded until we have a way to detect a
device's capabilities at runtime.

Issue #261

Change-Id: I3dd093b07f9a964116f81422f3c298dfbf7e2e52
2016-07-07 19:28:48 +00:00
Joey Parrish 316b7febb6 Merge pull request #426 from baconz/fix_live_check_in_fit_references
fitSegmentReferences: Check isLive() using presentationTimeline
2016-07-07 11:57:35 -07:00
Joey Parrish 422f5aa5cb Correct usage of jasmine's toBeCloseTo matcher
The second argument is meant to be the number of decimal places to
which the value must match, not the maximum difference.  So using
"0.1 decimal places" meant the maximum difference was actually 1.25.
You must pass "1" to get a maximum difference of "0.1".

This also adjusts some of the expectations to fix affected tests.

Change-Id: Ibc1223297011063e3e4f3fff0ba64fde06292128
2016-07-07 17:52:46 +00:00
Joey Parrish c1c176a529 Restore ClearKey license server support
- Restore ClearKey as a recognized key system in the DASH parser
 - Query key systems with configured license servers first, so that
   we can continue to differentiate between unavailable key systems
   and under-configured key systems.
 - Add a new ClearKey license server test asset.
 - Update tests.

Closes #403

Change-Id: Id5ef46d2d35a0217d313f03d403058c5c279e878
2016-07-06 17:25:37 -07:00
Joey Parrish 2dbadb15cc Show Cast receiver device name
Issue #261

Change-Id: Ia91178810c5ad4d353b9c96e396fda2ba4bfcff2
2016-07-06 20:57:43 +00:00
Joey Parrish 0c8f74493c v2 Chromecast support
This introduces Chromecast support directly in the v2 library, as well
as in the demo app.

See the included design doc for details.

Issue #261

Change-Id: I26a707e7fa6bd829c3ebc70e4c9345ec25eed000
2016-07-06 11:47:04 -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
Joey Parrish d68e8dd27f Fix key status and session expiration in DrmEngine
Also involves some cleanup:
 - Differentiate between WRONG_KEYS and EXPIRED.
 - Fix session expiration detection for CDMs without sub-second
   time resolution.
 - Export accumulated key status over all active sessions.
 - Update DrmEngine workarounds with bug links.

b/29919059

Change-Id: Ia4f12657285b0d431ed7a0c22ee4312375fdd40e
2016-07-01 20:24:06 +00:00