stream.segmented: add --stream-segmented-duration #5601
+162
−38
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.
Closes #5450
Replaces #5493
This PR implements the max stream duration in the
SegmentedStreamWorker
, as opposed to each worker subclass separately (previouslyHLSStreamWorker
), which is now possible with the switch towards a commonSegment
base class added in #5594 and the segmented stream changes prior to that (#5498).--hls-duration
has been marked as deprecated, as well as its respective session option.In the previous attempt (#5493), there were comments about the name of
--stream-segmented-duration
. This option now affects all segmented stream types, so we need a new name-prefix for that. The other--stream-segment-*
CLI args are about individual segments, not about the segmented stream types, so it doesn't make sense using that prefix here. We can't call the new option--stream-duration
either, because that would imply that it's possible to limit the duration for all kinds of streams, which is not true.Also, as mentioned, the related
--hls-start-offset
option needs to be changed as well in the future. This however requires more code refactoring, because of initialization segments which need to be written to the output first and can't be skipped. There's a fundamentally different implementation in the HLS and DASH streams regarding initialization segments which requires a rewrite of the HLS init segments, so the baseSegmentedStreamWorker
can work with init segments while skipping the first segments when using the start-offset option. The HLS init segment implementation is rather weirdand also incorrect, at least for fragmented MPEG4 segments, as it combines the content of each segment with its init segment, which is unnecessary (still works though). This was done because of MPEG-TS init segments, and nobody could interpret the HLS spec correctly and knew if the "init" segments were a requirement for each segment.(the incorrect behavior was fixed in #5689, but this is all still implemented very badly and requires a full rewrite based on how it's implemented in DASH)I will keep this PR as a draft until I have the start offset stuff ready because it doesn't make sense having partial/incomplete changes on the master branch.