Skip to content

Flatten periods and SegmentTemplate internally #1339

Closed
@joeyparrish

Description

@joeyparrish

Today, some of our most complex and subtle code is around period transitions. Player and StreamingEngine both have to manage a bunch of corner cases around transition points. The Player may be showing the set of tracks from period 1, while StreamingEngine and AbrManager are dealing with a different set of tracks from period 2.

StreamingEngine has complex code to manage period transitions and synchronize them across stream types (audio, video, text). The only thing that really needs to change between periods is the timestampOffset, append window, and init segment.

If we internally flatten out multi-period DASH, we can have a single list of segments that cross period boundaries. Each segment reference could contain its own append window, timestamp offset, and init segment reference. If the init segment changes between segment N and N+1, StreamingEngine could just fetch and append that init segment before the corresponding media segment. If the append window or timestamp offset change from one segment to the next, StreamingEngine could just pass those parameters to MediaSourceEngine before fetching and appending the next segments. StreamingEngine then would need no period-related state.

A consequence of flattening periods is that we would also have a consistent set of tracks. No manual selection would get undone at a period boundary. There would be no need to ask AbrManager to make choices at period boundaries. If representations in different periods were ill-aligned, these new tracks would map out multiple paths through those representations based on what would be chosen at different bandwidth levels. This mapping would be the most difficult part of the system to get right, but it would be isolated to the DASH implementation.

After this transition, our internal manifest structure would look more like HLS than DASH, which would enable us to then implement features like HLS discontinuities.

Much of this was originally proposed by @vaage internally.

This will unblock #1335, #1308, and #892. It may simplify #999 and #1307. It would fix #856 and #1543.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions