Commit Graph

21 Commits

Author SHA1 Message Date
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
Timothy Drews ebb9aa6420 Parse 'group' attributes. Issue #67
Change-Id: Iaa07ff56c59e030270b52856d8822bea21a3aa6c
2015-07-14 20:19:56 +00:00
Joey Parrish 7f8eba0704 Fix single-URL SegmentLists
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
2015-07-08 09:07:14 -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 1a5612d813 Fix broken MpdProcessor unit tests for Location.
Change-Id: Id6667a4d77729aa5c5f25635af43e253a8465f49
2015-06-25 10:49:48 -07: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 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
Timothy Drews 77e04e9a49 Destroy ManifestInfos during test tear-down.
Without destroying ManifestInfos some SegmentIndexes may
persist outside the tests they were created in, which may
cause spurious test failures.

Change-Id: Ia6c2fe312b7bd6cd2dcd338dd43c20ce0a5715d6
2015-06-18 11:03:04 -07: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
Timothy Drews 5b659acf9a Recover from unavailable live streams.
* 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
2015-03-30 19:19:53 +00: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 069d8c3e6d Write tests and fix bugs with manifest updates.
* Write an initial set of unit tests for
  StreamVideoSource.update().
* Correctly handle new manifests that omit periods, stream sets,
  and streams that existed in the original manifest.
* Make StreamVideoSource.update() synchronous.
* Disallow merging SIDX based SegmentIndexes.

Issue #21

Change-Id: Id2e0b8cf56dd4b878b654732b7a088422163f418
2015-03-25 15:00:06 -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 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 85cbc0e223 Fix # of segments computation in MpdProcessor.
* Correctly compute the number of segments when generating
  a SegmentList from a SegmentTemplate with a segment duration.
* Update unit tests.

Change-Id: Ic3edfd8c6eb8173ea52a4c606bbcd38c662de55f
2015-02-26 21:23:43 +00:00
Timothy Drews 3226db0d9d Handle gaps/overlaps in SegmentTimeline.
* 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
2015-02-19 17:47:01 +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
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