Commit Graph

31 Commits

Author SHA1 Message Date
Jacob Trimble 5637962073 Offline now doesn't use data URI for init data.
Also now uses the same ContentDatabaseReader for offline segment
requests.

Change-Id: I9cebc90b46ca9067467a8a343d48b264abc7cf26
2015-10-19 23:10:22 +00:00
Timothy Drews 6bbdad3156 Improve internal docs for VideoSource and Stream.
* Document timestamp correction better.
* Add additional API details to Stream.
* Tidy-up and make comments/docs more consistent.

Change-Id: I41d873967a930634fa48c83fe65b6e9cf512d782
2015-10-07 21:26:13 +00:00
Joey Parrish 4cc4e96dbd Overhaul license comments and file annotations
* Updates all Copyright years to 2015.
* Adds licenses annotations to all JS.
* Makes all licenses identical to avoid repeated appearance in the
  compiled output.
* Drops fileoverview annotations, which do not affect docs output.
* The linter still requires fileoverview on externs.

This patch required a newer closure compiler, since the previous
version we used had a bug regarding license annotations that caused
the license comment block to appear in the output once per file
regardless of uniqueness.

Change-Id: I2e9272db680cba7ecc4613d97f1d3a94ac2244cc
2015-09-08 12:02:34 -07:00
Joey Parrish 4d9177240a Revert "Adding license annotation to js files."
This reverts commit 8cb24652cb, due to
the fact that the new annotations caused our binary size to jump
by 52%.

The compiler preserves all 'unique' licenses, which causes trouble
since the comment blocks with the license annotations are not unique
and contain file overview comments as well.

We can re-examine this once we have restructured the license headers.

Change-Id: I418e407a0e0253630633697f30cf496a7fc2ddfc
2015-09-04 18:36:39 -07:00
Yohann Connell 8cb24652cb Adding license annotation to js files.
Change-Id: Id10592ccaf35608ac4f01844cae2fec4a2030d65
2015-09-04 00:05:17 +00:00
Joey Parrish 97769bd413 Clean up exceptions on Player.destroy()
This introduces a new method on PublicPromise called destroy(),
which does for Promises what destroy() does for the other classes:
shuts down async processes and cleans up references.

In addition to catching errors and shutting down more cleanly in a
wider array of circumstances, this may also help with GC, since we
no longer leave pending Promises around with handlers attached to
them.

Closes #151

Change-Id: I205c5979418fbc18cd7e35d91d0de2746f337137
2015-09-01 00:16:05 +00:00
Timothy Drews 49e34bce2d Create SourceBuffer objects in SBM.
* Create SourceBuffer objects in SBM instead of StreamVideoSource.
* Apply timestamp offsets in SBM.fetch(), which allows for different
  streams to have different timestamp offsets.
* Improve log messages in SBM by using MIME type information.

Change-Id: Ibad7c91fa5937e053db84b8e2d6e71957652ddc2
2015-08-25 23:12:20 +00:00
Timothy Drews f7d1a2dc73 Improve error reporting for unplayable content.
* Reject fetch() Promise in SBM if appending a segment doesn't
  actually buffer the segment.
* Remove an 'assert' in Stream that was triggering for self-initializing
  streams.
* Improve log messages in Stream.

Change-Id: I8c74ae24948e7a8fc2bd7539f617a7932a2b9f43
2015-08-24 17:27:13 +00:00
Timothy Drews f5c4eb1667 Improve end-of-stream behavior.
For static content, if the playhead moves to the end of the video then
either the video should pause or loop. Before this patch media timeline
misalignment and buffering detection would sometimes prohibit this from
happening.

* Ensure the MediaSource's duration is >= the end of each
  stream's last segment (both before and after timestamp correction).
* Use an append window to keep the MediaSource's duration constant.
* Rework Stream startup so that the MediaSource can be modified
  safely during timestamp correction.
* Remove timestamp correction member variables from StreamVideoSource.
* Fix buffering detection when there are no buffered ranges.
* Add sanity checks and improve logging for debugging MSE issues.
* Improve Stream startup documentation.

Closes #155

Change-Id: I6f7a1d15240af62a2282f3f62b29cd3acd5b1873
2015-08-19 09:30:00 -07:00
Timothy Drews 97809a008a Rename RangeRequestTimeout opt. & fix unit convs.
* Rename the RangeRequestTimeout option to SegmentRequestTimeout
  since the RangeRequest class no longer exists.
* Fix a few unit conversion errors between seconds and
  milliseconds and vice versa.

Change-Id: I8695c3bfb79ae0e20ec5bc75d9ae9f941bccd023
2015-08-13 16:41:27 +00:00
tdrews 7d308a15db Merge pull request #144 from blinkbox/pull-request/clear-buffer-on-switch
Optional offset param to IVideoSource.selectVideoTrack for partial buffer clear
2015-08-12 09:45:45 -07:00
Jono Ward d5d43c671b Add optional offset param to IVideoSource.selectVideoTrack, which allows a partial clearing of the buffer to occur 2015-08-11 13:50:50 +01:00
Jacob Trimble 899c322995 Added support for multiple BaseURL elements.
Added a new class called FailoverUri which handles multiple URLs and
switches to others when one fails.  This is also handles the request
itself.  This replaces SegmentMetadata as well as a number of manual
requests.

The MPD parser now produces arrays of URIs rather than just one.  The
MPD Processor then converts it to a FailoverUri inside the manifest.

Added unit tests to test the new functionality and updated the old ones
to the new changes.

This does not support failover on subtitles since subtitles are handled
by the browser.

Closes #68

Change-Id: I5410104827b9e4102b243444b1b5a3f01dcaf10d
2015-08-10 16:01:06 -07:00
Natalie Harris 3936bfafb6 Player configuration should not use static variables.
Closes #126.

Change-Id: Ib8ef19e46918276f28d6539a158517f8558867d1
2015-08-04 08:51:22 -07:00
Timothy Drews 38f70c5aeb Recover from failed segment requests.
* Reject Task Promise if one of its stages fails so that the caller's
  catch handler is invoked.
* Use TypedBind consistently in affected Promise chains.

Closes #131

Change-Id: I94fa6688949444212fa0b1edd3a94e0de4d6956f
2015-07-21 20:05:15 +00:00
Timothy Drews f08fbba66c Detect and recover from multiple buffered ranges.
There should never be multiple buffered ranges, but if there are
then at least try to keep playing.

Issue #121

Change-Id: I562bdb194dcc1f66701ad1b5bb3246b4e2fbe431
2015-07-20 18:20:37 +00:00
Joey Parrish 328aa27c59 Fix type-inference issues with newer compilers
Newer versions of the Closure Compiler issue warnings for several
anonymous functions due to what appears to be a failure to infer
certain types.  This patch uses TypedBind to mollify the compiler.

This patch also fixes another issue raised by the newer compiler,
which is that index does not have duration and key_system properties.

b/21559591

Change-Id: Icff84ad084bfcd049f962bd4a0698b3fc78fc279
2015-07-13 13:56:16 -07:00
Joey Parrish dee2f372a6 Be strict about nullability and scope
This fixes errors in newer versions of the Closure Compiler.

b/21559591

Change-Id: I3b9f08ccca81deb0f2bc0c7f2bb755d91285ec1e
2015-07-13 19:01:51 +00:00
Joey Parrish 146d0c1c14 Stop using @suppress {accessControls} to assert
This suppression no longer works on this scope in newer versions of
the Closure compiler.  In any case, making the assertions in the
class that owns those members is a better design.

b/21559591

Change-Id: I27696b3fd3c5a87bb595e5c6952ca7a523132f5f
2015-07-13 19:01:23 +00:00
Timothy Drews 34915527f0 Complete stream rework: refactor seek ranges.
* Move seek range updates into SegmentIndex implementations
  and StreamVideoSource.
* Remove unnecessary sub-class hooks from StreamVideoSource.
* Remove internal LiveSegmentIndex timer: do SegmentReference eviction
  and generation on demand.
* Rework Stream startup again: consider Streams as started when they
  have buffered some minimum amount of content. As part of this, only
  apply a timestamp correction to the SBM when the streams have started.
* Defer stream switches until all SegmentIndexes have been corrected.
* Partially revert optimistic "bufferedAhead" calculations in Stream:
  check if we've buffered enough content at least every second.
* Make LiveSegmentIndex more robust against a "wrong"
  @availabilityStartTime.
* Fix a bug where a positive timestamp correction would trigger an extra
  Stream resync.
* Fix a bug in evict_() where the first segment would never get evicted.
* Check stream started conditions in onUpdate_ instead of after a segment
  has been inserted.
* Tidy-up immediate/clearBuffer naming and other comments.

Closes #51
Closes #109

Change-Id: Ic6f0b96065d3c5dfb5c03ca1c52363bd77b22875
2015-07-06 14:20:01 -07:00
Timothy Drews fbea2279b3 Re-work stream switching.
* Allow segments from different streams (Representations) to coexist
  in buffer.
* Only fetch a single segment at a time.
* Remove id field from SegmentReference and remove SegmentRange.
* Only start the Streams once the buffer is "full".
* Stop DashVideoSource from triggering an extra resync during startup.
* Make Task.abort call order deterministic.

A follow-up patch is required to handle certain seek patterns in
live streams.

Issue #51

Change-Id: Ib7c9021471f1ed89323f19764463202b119cb491
2015-06-18 12:54:25 -07:00
Joey Parrish d3a5daf2ad Refactor 404 handling for live streams.
* Remove the acceptableErrors system and replace with a status check
  in SBM on request failure.
* End an SBM fetch task early on 404 or 410, but only during start
  and switch.
* Retry segment fetch to recover from 404/410 errors sooner.
* Set retry delay based on segment duration.
* Remove the 'truncated' fetch mechanism and the 'pleasebuffer'
  mechanism.  (Retry is more robust than entering a buffering state.)
* Retry MPD requests as well.  (Some live streams seem to experience
  very transient 404 errors when requesting updates.)

Issue #21.

Change-Id: I2d3b838a9afe950e9ed0a91da9b952d8a30bf0a1
2015-04-15 10:24:49 -07:00
Timothy Drews 9672a4e907 Disallow null estimators.
Change-Id: I9e687c11009d64b3de0924de0e0fec3a55d0775c
2015-04-10 22:24:46 +00:00
Joey Parrish deb2100cd1 Ignore 404 and 410 errors on segment fetch.
Relates to #21

Change-Id: Ib834e217aa14b83d2d5e42d05dd65491cab82cb8
2015-03-30 15:08:03 -07:00
Joey Parrish 84b1ee3b07 Refactor SourceBufferManager.
This leverages Task to close some race conditions on abort.

Change-Id: I0089de1484b89734c31aafcd36b16597bde98024
2015-03-27 22:51:57 +00:00
Timothy Drews 0f7069588a Change 'segmentNumber' to 'id' in SegmentReference.
* The segmentNumber member in SegmentReference is used as an ID,
  so rename it and update the doc string.
* Tidy up SegmentIndex unit tests.

Change-Id: I888b8cbfd6a198bab09f6ab846cbdbf70cfcaa5a
2015-03-26 19:09:50 +00:00
Joey Parrish 9441c5a720 Calculate buffering based on media timestamps.
The Stream should not rely on the segment index for timestamps, since
this can be inaccurate, especially for live content.

Closes #44

Change-Id: Ie7202e04b6a96c3758541680ceed781bf6bd2ab3
2015-03-25 22:29:23 +00:00
Timothy Drews 44af1e4518 Implement initial support for live streams.
* Implement an update() method on StreamVideoSource that merges
  a new manifest into its existing one.
* Re-fetch and re-process MPDs from DashVideoSource to generate new
  SegmentReferences.
* Compute last available segment numbers and times in MpdProcessor
  when generating SegmentLists.
* Re-work Period computation in MpdProcessor.
* Handle stream EOF differently for live content.

Additional work is required to handle all "styles" of manifests.

Issue #21

Change-Id: I38be9513dc73e4683d1079b4dedb489e8206043d
2015-03-18 09:11:52 -07:00
Timothy Drews 952057a00c Refactor segment metadata fetching.
Move segment metadata fetching into StreamInfo so that segment metadata
can be retreived outside of Stream. This enables other components to
access segment indexes.

Change-Id: I322bcf7cdabc7daecb5d554834275c1b6d1775ee
2015-02-25 01:00:00 +00:00
Joey Parrish 4f35f23fb5 Fix seeking dead-zone when data gets evicted.
Checks to see if a seek is within the buffered zone or not.
Clears the SourceBuffer if seeking outside the buffered zone.

This allows the efficient indexed lookup for inserted segments to still
be used while streaming, optimizes buffered seeks, keeps the playback
timeline sane in spite of the browser's eviction strategy, and obviates
the need for an earlier fix for some other MSE weirdness.

Closes #15.

Change-Id: I0226ebb679fab6739d3d0cc071e22f434983c9d2
2015-01-29 16:36:00 -08:00
Timothy Drews 36fec68e75 Create 'media' namespace for stream generic code.
* Move internal non-DASH specific code into the 'media' namespace.
* Remove DASH references from generic stream code.

The documentation is not changed as a follow-up patch will factor out
DASH functionality from StreamVideoSource back into a new
DashVideoSource class.

b/18903621

Change-Id: I78d6e4f2824d4983619f17872828d95655fcfe50
2015-01-26 15:08:48 -08:00