Skip to content

Optimization of manifest processing (ObjectIron)

Created by: Gontran-Molotov

This PR is a refactoring of objectiron.js in order to greatly reduce the time to process manifests, especially on low resource devices like Chromecast. This reduces join time, and improves UX for live streams as manifests are downloaded repeatedly.

ObjectIron is used to apply inheritance of XML attributes and elements in the manifest. For example, SegmentBase, SegmentTemplate and SegmentList elements may be present in the Representation element. In addition, to express default values, they may be present in the Period and AdaptationSet ancestors. In the Representation element, SegmentBase, SegmentTemplate and SegmentList shall inherit attributes and elements from the same element on a higher level. This is processed using ObjectIron.

ObjectIron uses mappers to define which elements and attributes must be inherited:

  • the SegmentValuesMap.js mapper is used to apply inheritance of SegmentBase, SegmentTemplate and SegmentList elements through the Period > AdaptationSet > Representation hierarchy
  • the RepresentationBaseValuesMap.js is used to apply inheritance of common Adaptation Set, Representation and Sub-Representation attributes and elements through the AdaptationSet > Representation > SubRepresentation hierarchy

The main drawback of the current ObjectIron implementation is that it loops recursively over all the node hierarchy of the manifest to find Period and Representation elements at any level. This is inefficient as Period elements are only children of the MPD element, and AdaptationSet elements are only children of Period elements. This PR optimizes this by targeting specifically MPD > Period and Period > AdaptationSet elements to apply inheritance, without looping over the full node tree.

Additional changes include:

  • Make ObjectIron a JS class. Remove unused local variables. Fix lint errors.
  • Removed useless isRoot and isArray properties from MapNode (isRoot is never set to true, isArray is always true). Removed dead code depending on those properties from ObjectIron
  • Removed unused merge parameter from the CommonProperty constructor.
  • Updated unit tests for MapNode and CommonProperty accordingly

Please test with different types of manifests. Comments and Feedback are welcomed.

Merge request reports