mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-15 16:06:41 +03:00
08cec995c9
This replaces find/get callbacks in Stream with a SegmentIndex. With the exception of DASH's SegmentTemplate+duration, all manifests were already backed by SegmentIndex. Now, all manifests are backed by SegmentIndex. This will simplify Period-flattening, in which all tracks will be represented by a list of segments, some of which come from different Periods. The SegmentIndex in Stream will not be created until createSegmentIndex is called. Prior to this change, the find/get callbacks could be invoked without createSegmentIndex() in some cases (excluding DASH's SegmentBase), which some lazy tests took advantage of. Now that find/get are methods on SegmentIndex, createSegmentIndex must be called in all cases. The tests have been updated accordingly. Making SegmentIndex generation async in all cases exposed some issues with the parser context being modified in-place between one Representation and the next. So the parser now makes a shallow copy of the context before it is bound into an async callback. To facilitate updating the SegmentIndex for SegmentTemplate+duration content, SegmentIndex now has a method to update its list on a timer. Once per segment duration, the index will be updated to add and remove SegmentReferences. The initial expansion of SegmentTemplate+duration will be limited to a relatively small number of segments, to avoid excessive CPU or memory consumption. This defaults to 1000 segments, but is configurable. Issue #1339 Change-Id: I99c007b1096c3b396d04a729750cd7b743cb899d