Some versions of the compiler do not seem to recognize this as
unreachable, so add a return to satisfy the compiler and silence
the warning.
Change-Id: I55485d2847616be696b6c4f908e2042cb4c00392
* 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
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
Use 'keystatuseschange' events from EME together with cenc:default_KID
from the MPD so StreamVideoSource can determine if the key system
can/will decrypt a stream before it attempts to play it. This enables
the Player to safely (and automatically) switch between streams that
are encrypted with different keys.
Support AdaptationSet @group, which is the preferred approach to safely
use multiple encryption keys over multiple Representations.
* Squash AdaptationSets from the same group into one StreamSetInfo.
This enables support for @group without introducing special case code
into StreamVideoSource and EmeManager.
* Fire 'trackchanged' events when tracks becomes available/unavailable
either from application restrictions or key status changes.
* Pull key IDs out of DrmInfo and put them into StreamInfo so key status
changes can drive per stream availability instead of per StreamSet
(AdaptationSet) availability.
Closes#67
Issue #160
Change-Id: Ife0814deb65715923a572b45880137a99b378035
Can now specify negative values for the r attribute in SegmentTimeline.
Not supported with live when used on the last element.
Issue #162
Change-Id: I7206e02f7af469a7daf1e4710befb2d102f4f979
Add new ContentProtection interpretation API that allows applications to
return multiple DRM configurations for each ContentProtection element
and to parse raw ContentProtection XML elements.
This patch deprecates DrmSchemeInfo in favor of DrmInfo. Furthermore,
DrmSchemeInfo will be removed post v1.5.0.
* Replace DrmSchemeInfo with DrmInfo.
* Move Restrictions class definition into its own file.
* Populate initData values from explicit PSSHs without application
intervention.
* Allow explicit PSSHs to differ between Representations
Issue #71
Issue #137
Closes b/23428584
Change-Id: Ib8d6ba630b930ee64f923a3f4a3e518abacccf88
This allows the app to intercept media requests to modify its URLs.
The callback accepts the URL for the request and returns a modified
URL or null to use the original.
Closes#148
Change-Id: I08352754ace05f318706fd93910097c0fa7696f0
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
A SegmentTimeline can appear inside a SegmentList and describes the
duration of the items in the list. A SegmentTimeline can also be
inherited from the Period or AdaptationSet. These have all been
added. Also added SegmentList support for dynamic MPDs.
Closes#88
Change-Id: I849491b1c6a5808a58c597eccfd439154e2e6ecd
This allows an app to specify an external caption source so the captions
can come from a different source than the MPD. The method should be
called before the call to load().
Closes#133
Change-Id: I0686fd800e0fe3a73d89a71e2f374dffef905dba
* Make the order of properties consistent between
AdaptationSet and StreamSetInfo.
* Mark all MPD related constructors as @struct.
Change-Id: I7016aafb0bf073e6e4972b34e267ad6ef87f810c
Previously, a SegmentList with a single URL resulted in a reference
with no end time. Now the library can correctly deduce the end time
of a one-reference SegmentList.
Change-Id: Ia4ed3895e8b3c5da3e8713d944090bbab579f3de
* 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#51Closes#109
Change-Id: Ic6f0b96065d3c5dfb5c03ca1c52363bd77b22875
Reflect modifications made in ISO/IEC 23009-1:2014/Cor 1:2015:
allow @startNumber to be 0 and compute the $Time$ placeholder using
the segment number relative to the start of the Period.
Closes#10
Change-Id: I4a9b0e4e3593c01e2e8d42a74572e78b9fba50d9
* 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
This patch reworks SegmentIndexes so that any SegmentReference they
contain is guaranteed to be available. This makes SegmentIndexes work
consistently between static content and live content (specifically
content specified using SegmentTemplate with @duration).
* Rework StreamInfo to use a ISegmentIndexSource and a ISegmentInitSource,
which construct a SegmentIndex and an intiailization segment
respectively.
* Make ManifestInfo destructible and various async operations in
StreamVideoSource safer.
* Introduce LiveSegmentIndex, which manages SegmentReference eviction.
* Introduce DynamicLiveSegmentIndex, which manages SegmentReference
eviction and generation.
* Implement improved segment availability logic for segment eviction.
* Move SegmentIndex construction from MpdProcessor to several
ISegmentIndexSource implementations.
* Use a SegmentIndex to represent subtitles to simplify Stream creation
in StreamVideoSource.
* Move manifest update code from StreamVideoSource to ManifestUpdater.
* Move PeriodInfo.duration determination in MpdProcessor to StreamVideoSource.
* Since "forced" manifest updates are no longer required for content
specified using SegmentTemplate with @duration, simplify manifest update
code in DashVideoSource.
* Make Stream continue to update even if it runs out of
SegmentReferences, this simplifies previous resync logic and makes
DynamicLiveSegmentIndex work seamlessly.
* Refactor SegmentIndex and initialization fetch code in ContentDatabase.
* Download all SegmentIndexes in the background after the initial streams
have started.
Follow up work is required to remove seek range logic from
DashVideoSource.
Change-Id: I4a908195aba632a911a6e55213fc41d41428162b
Also avoid fetching manifest updates when minimumUpdatePeriod is
missing. In the absence of minimumUpdatePeriod, just reprocess
the MPD we already downloaded.
Closes#69, #70.
Change-Id: I138bf136e5b0d691d9d625bbad02fb07ae21d32f
* 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
Strip extraneous minBufferTime copies.
Default minBufferTime in MpdProcessor if missing.
Pass minBufferTime as a parameter to Stream.start().
Keep a buffering goal separate from minBufferTime, which will only
be used for stream startup (as intended by the DASH spec).
This allows us to startup quickly and still buffer ahead.
Relates to #51.
Change-Id: I94b6b2566419344fa761ff75b0884719f255cd66
Since SegmentTimeline streams may not have segment numbers, we should
not use segment numbers as reference IDs. These IDs must be unique
for the buffering and streaming systems to function properly.
This also adds assertions to check that reference IDs are unique.
Issue #21.
Change-Id: Ia94a48c68149283f87d27c6595a4f5a6cca07a27
A SegmentIndex only provides an approximation of its media timeline. The
differences between the two can be particularly problematic if the
SegmentIndex is "behind" its media timeline, as such an offset may cause
the stream to get stuck during startup.
* Correct each SegmentIndex using timestamps in the actual segments.
* Make hasStarted() return true only after the Stream fully initializes.
* Adjust the seek range after computing a timestamp correction.
* Set timestampOffset for all types of SegmentTemplate based manifests.
* Remove PTO rounding, which is not required with timestamp correction.
* Only attempt to resync Streams after all streams have started.
Change-Id: Id03c38826d07513d8f451029ffc9d891854c19df
* Only fallback to 0 for the earliest timestamp if there are
no segments.
* Don't allow the best timestamp to be less than the earliest
timestamp.
Issue #21
Change-Id: Ie4df6e36d60adc0ee0dfc54dcbefef7ae0de2705
* Make function order in mpd_processor.js match function
dependencies.
* Make a two line parameter list into a one line parameter list.
Actual code and comments are not changed.
Change-Id: I586b2552601a3c36c5cd1711f4589447213462a4
* Rename SegmentIndex functions to shorter names.
* Add first() and last() functions for convenience.
* Throw exceptions for out of range errors.
* Handle more corner-cases in merge().
* Add more unit tests.
Change-Id: If875cd766e7091504c028413694326fcdf2aae5b
* After updating a manifest restart any streams that failed
to initially start.
* Seek to the stream start time only after the streams have been
initialized, seeking before can cause lock-ups with MSE.
* Rename 'bestStartTime' to 'currentSegmentStartTime'.
Issue #21
Change-Id: Ibad91fe2d5171196e93f20961008cdd25ecc437e
* Construct the initial SegmentIndex for a live stream such that it
includes at least @timeShiftBufferDepth seconds of content before
the "live-edge".
* Use segment numbers relative to @startNumber instead of relative
to the start of the Period in SegmentReference to handle MPDs
with partial segment information.
* Start live streams near the "live-edge", a.k.a., "best start time",
and start static streams at the latest start time.
Issue #21
Change-Id: I3c553a1b7120a59c68f19cdc85f412f31972c1b8
* Expand SegmentTemplates directly to StreamInfos instead of using
intermediate SegmentBases and SegmentLists.
* Remove "fake" attributes from SegmentBase and SegmentUrl.
* Simplify Period duration derivation.
* Add additional unit tests.
Change-Id: I203e269bd9dfb1fb1cc4ca48be29043c1ee4007b
* Set SourceBuffer.timestampOffset to StreamInfo.timestampOffset
directly.
* Compute StreamInfo.timestampOffset in MpdProcessor.
Change-Id: Iea5621bc29df3de29d378e58720d6f71452274cd
The clock will be synced, when possible, to the server hosting the
MPD. The synced clock will only be used in places where accurate
time matters, such as in loggable player stats and in live streaming.
Relates to #21
Change-Id: Id9da1cf23a781f2ce07a46e0936695d512a65133
* 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
Assume a year is 365 days and a month is 30 days. Supporting years and
months is useful as some MPDs that describe live content specify
@minimumUpdatePeriod in terms of years; here, an accurate number of
seconds is not needed, but the duration string should not be treated as
invalid.
Change-Id: Ic4ea26f5a7572711e047c237dced33d80a698840
* Instead of overriding SegmentBase, SegmentList, etc. between
levels (e.g., from Period to AdaptationSet) merge them, but
prefer elements and attributes from inner levels.
* Refactor MPD parsing unit tests into separate files.
* Rewrite SegmentBase unit tests, add SegmentList, and
SegmentTemplate unit tests.
Change-Id: I3fdb7657bb9f468e10f63e47e9a52fbf8ebbd40b
* Correctly compute the number of segments when generating
a SegmentList from a SegmentTemplate with a segment duration.
* Update unit tests.
Change-Id: Ic3edfd8c6eb8173ea52a4c606bbcd38c662de55f
This removes reliance on MediaKeys.isTypeSupported and instead uses the
supportedConfigurations parameter of requestMediaKeySystemAccess.
A lot of refactoring went into this effort, particularly around
StreamVideoSource, StreamSetInfo, and StreamInfoProcessor.
Closes#2, b/19354928.
Change-Id: Ibf81da909b8207b5babaec5ef0422dd1293d130d
* Stretch/compress segments within a SegmentTimeline to align them
to the beginning of the next segment.
This does not allow playback of content with actual gaps in it, but
allows MPDs with inaccurate SegmentTimelines to be used.
Closes#24, b/19144876
Change-Id: I183935db23fe26e1d6295e099b201a6af487d53b
* Revert 5c7fca90b6, which intended
to allow startNumber to be 0, and maintain the previous behavior,
which requires startNumber to begin at 1 (this appears to be in-line
with the MPD spec).
* Correctly compute the $Time$ placeholder.
* Rename firstSegmentNumber to startNumber to clarify code.
Closes#10
Change-Id: I9b565edc9e23b9ad7c6bc62829d6b0ab565008a4
* Adjust SourceBuffer timestamps forward by the Period's
start time and backwards by the Representation's
presentationTimeOffset.
* Incorporate the start time of a Representation's first
segment in the calculation of a Period's duration.
* Seek to the latest start time before starting playback.
Further adjustments will be required to support live playback.
Closes#17, b/19130302
Change-Id: Ia9fe6d8bbe5a69488130de2d8b146ce54dfff50e