stream.dash: fix old timeline ID workaround #5199
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
stream.dash: fix old timeline ID workaround
When building segment timelines, don't use the
mimeType
attribute of theSegmentTemplate
's parent node as a fallback when the parent'sid
attribute is missing.This doesn't work if the parent node is a
Period
, as it doesn't have themimeType
attribute, and it also generates timeline keys which are not unique if two streams of the samemimeType
would get muxed (currently not supported).Instead, build an
ident
tuple on theRepresentation
instance consisting of the ids of the parentPeriod
andAdaptationSet
, and theRepresentation
itself, with its requiredid
attribute. This ensures a unique key for thetimelines
dict.Then simply pass the
ident
tuple to theSegmentTemplate.segments()
generator, similar to theBaseURL
fixes of e684913.stream.dash: refactor DASHStream{Reader,Worker}
Use the newly added
Representation.ident
for finding the sameRepresentation
after a manifest reload of a dynamic DASH stream.Also use the worker's
period
attribute instead of the hardcoded zero index, even though only the first period is supported.The missing parent ID workaround was initially implemented in #2096.
There's still a lot to do to fix some of the biggest issues with the DASH implementation. For example, manifest reloads are only attempted once without any retries, and failed manifest reloads or segment downloads can cause a deadlock. And much more...