Files
shaka-player/lib/util/map_utils.js
T
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

51 lines
1.2 KiB
JavaScript

/**
* Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @fileoverview Map utility functions.
*/
goog.provide('shaka.util.MapUtils');
/**
* @namespace shaka.util.MapUtils
* @summary A set of map/object utility functions.
*/
/**
* Returns true if the map is empty; otherwise, returns false.
*
* @param {!Object.<string, T>} object
* @return {boolean}
* @template T
*/
shaka.util.MapUtils.empty = function(object) {
return Object.keys(object).length == 0;
};
/**
* Gets the map's values.
*
* @param {!Object.<string, T>} object
* @return {!Array.<T>}
* @template T
*/
shaka.util.MapUtils.values = function(object) {
return Object.keys(object).map(function(key) { return object[key]; });
};