Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(DASH): Fix creation of multiperiod trickmode streams #7229

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions lib/util/periods.js
Original file line number Diff line number Diff line change
Expand Up @@ -890,26 +890,33 @@ shaka.util.PeriodCombiner = class {
// Create a fresh output stream for trick-mode playback.
output.trickModeVideo = shaka.util.PeriodCombiner.cloneStream_(
input.trickModeVideo);
// TODO: fix the createSegmentIndex function for trickModeVideo.
// The trick-mode tracks in multi-period content should have trick-mode
// segment indexes whenever available, rather than only regular-mode
// segment indexes.
output.trickModeVideo.matchedStreams = [];
output.trickModeVideo.createSegmentIndex = () => {
// Satisfy the compiler about the type.
goog.asserts.assert(
output.segmentIndex instanceof shaka.media.MetaSegmentIndex,
'The stream should have a MetaSegmentIndex.');
output.trickModeVideo.segmentIndex = output.segmentIndex.clone();
if (output.trickModeVideo.segmentIndex) {
return Promise.resolve();
}
const segmentIndex = new shaka.media.MetaSegmentIndex();
goog.asserts.assert(output.trickModeVideo.matchedStreams,
'trickmode matched streams should exist');
for (const stream of output.trickModeVideo.matchedStreams) {
goog.asserts.assert(stream.segmentIndex,
'trickmode segment index should exist');
segmentIndex.appendSegmentIndex(stream.segmentIndex);
}
output.trickModeVideo.segmentIndex = segmentIndex;

return Promise.resolve();
};
}

// Concatenate the trick mode input onto the trick mode output.
output.trickModeVideo.matchedStreams.push(input.trickModeVideo);
shaka.util.PeriodCombiner.concatenateStreams_(
output.trickModeVideo, input.trickModeVideo);
} else if (output.trickModeVideo) {
// We have a trick mode output, but no input from this Period. Fill it in
// from the standard input Stream.
output.trickModeVideo.matchedStreams.push(input);
shaka.util.PeriodCombiner.concatenateStreams_(
output.trickModeVideo, input);
}
Expand Down
Loading