Commit Graph

30 Commits

Author SHA1 Message Date
Jacob Trimble fdcee73fb4 Added partial support to specify negative r values in SegmentTimeline
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
2015-08-25 19:50:05 +00:00
Timothy Drews dc008cc6cf Parse the default_KID attribute.
Issue #67

Change-Id: I7df48dcad94823b2937b3bc88a0d5d9c6087edc5
2015-08-25 18:33:22 +00:00
Timothy Drews 1c58dee0c2 Add new ContentProtection interpretation API.
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
2015-08-24 10:41:41 -07: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
Jacob Trimble f610cbf4c9 Added support for SegmentTimeline inside a SegmentList.
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
2015-08-03 16:54:28 +00:00
Jacob Trimble 320a9ec9f5 Added addExternalCaptions method to DashVideoSource.
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
2015-07-28 16:57:36 -07:00
Timothy Drews ebb9aa6420 Parse 'group' attributes. Issue #67
Change-Id: Iaa07ff56c59e030270b52856d8822bea21a3aa6c
2015-07-14 20:19:56 +00:00
Timothy Drews bcdbc16ed9 Move 'main' property to correct class.
* Make the order of properties consistent between
  AdaptationSet and StreamSetInfo.
* Mark all MPD related constructors as @struct.

Change-Id: I7016aafb0bf073e6e4972b34e267ad6ef87f810c
2015-07-13 17:17:39 +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 4d96b30ba5 Use @startNumber as specified in new MPD spec.
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
2015-06-26 18:46:37 +00:00
Timothy Drews e8cabb6029 Use the Location element for MPD updates.
Closes #65

Change-Id: I92790ba3502cde5899085f02c6a80a48ba093ee2
2015-06-24 00:59:36 +00:00
Timothy Drews 22c57e99e4 Rework SegmentIndex functionality.
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
2015-06-09 11:46:40 -07:00
Joey Parrish 7dc3c1b0a9 Choose live playback by type='dynamic'.
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
2015-04-28 11:59:55 -07:00
Vignesh Venkatasubramanian 72fe1b2ce6 mpd parser: Handle minimumUpdatePeriod being set to 0.
For live streams, minimumUpdatePeriod can be set to 0. It means that
we shouldn't refresh the manifest until there's an explicit signal
from within the stream. As of now, there's no way to get that signal
from MSE. So as a workaround, if we see a minimumUpdatePeriod of 0,
we set it to 10 seconds. This is similar to how Exoplayer and Dash.js
handle this case.

[1] https://github.com/Dash-Industry-Forum/dash.js/blob/fe14ee023c0e3aa073284ce034758942e8f3c7bf/build/test/js/utils/MPDHelper.js#L12
[2] https://github.com/google/ExoPlayer/blob/953e1118a58a269ded8b0246874bd827d900fcf0/library/src/main/java/com/google/android/exoplayer/dash/DashChunkSource.java#L270
2015-04-21 18:17:18 -07:00
Joey Parrish a849f033ea Remove reliance on node.children.
Use the slightly more old-fashioned childNodes property instead.

Change-Id: Iade1ff63b4f86d53712ac818024c02f5e9b658b7
2015-04-21 16:12:15 -07:00
Joey Parrish 10f80d2577 Refactor minBufferTime and bufferingGoal.
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
2015-04-14 14:35:02 -07:00
Timothy Drews a8e567c9db Start live streams near the "live-edge".
* 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
2015-03-25 15:43:33 -07:00
Timothy Drews bc8c2bcf49 Refactor MpdProcessor.
* 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
2015-03-24 18:25:22 +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 4a5738d881 Support years and months in xs:duration strings.
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
2015-03-06 13:25:12 -08:00
Timothy Drews 27ed78203a Merge Segment{Base, List, Template} across levels.
* 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
2015-03-05 01:20:07 +00:00
Timothy Drews b244def2f4 Fix-up startNumber behavior.
* 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
2015-02-13 18:45:59 +00:00
Timothy Drews 7e5983feac Change SourceBuffer timestamp offset calculation.
* 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
2015-02-11 22:16:23 +00:00
Joey Parrish d3e1e0a329 Fix linter error.
Change-Id: Ia3c351b7b0a037a0c61c4c925ac5e3b2c5434b63
2015-02-04 21:35:13 +00:00
Joey Parrish a92d673b1a Add support for the Role tag.
AdaptationSets are sorted by language (audio-only), then by those with
the "main" role.  Main sets are preferred when there are multiple to
choose from.

Closes #20, b/19214703.

Change-Id: I4fdd601c0bd7c7d29801084199123311ab9dbec3
2015-01-30 15:18:43 -08:00
Joey Parrish f7d9ea5794 Refactor StringUtils into Uint8ArrayUtils.
Most of these StringUtils were either operating on Uint8Arrays directly
or using strings to move around Uint8Array data anyhow.

Change-Id: I71efe6ede34210ca721d46acd53452344efff5bb
2015-01-29 09:41:06 -08:00
Timothy Drews c8036b8cad Decouple DashVideoSource and DashStream from MPD classes.
* Create generic stream description classes to represent
  Representations, AdaptationSets, and Periods.
* Move generic stream selection logic out of MpdProcessor and
  into StreamInfoProcessor.
* Refactor DashVideoSource and DashStream to use the generic
  stream description classes.

A follow-up patch is required to re-organize files and namespaces.

b/18903621
b/18948677

Change-Id: I8bbb87ebf0242b31541199d0d1d3c40767c93a29
2015-01-26 15:08:48 -08:00
Timothy Drews 5c7fca90b6 Allow startNumber attribute to be 0.
Closes b/19093388, #10.

Change-Id: Ie05b1f337f4ffd6b24d3e56666663a2ecc284deb
2015-01-26 15:08:48 -08:00
Joey Parrish d4df6987e7 Shaka Player release v1.1 2015-01-15 15:12:58 -08:00
Joey Parrish b3d035be9f Shaka Player release v1.0 2014-12-19 14:26:19 -08:00