Skip to content

Commit

Permalink
fix(DASH): SegmentTemplate@media not updated after change in manifest (
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed Nov 22, 2023
1 parent 42c6e5f commit a61538a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/dash/segment_template.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ shaka.dash.SegmentTemplate = class {
);
} else {
const tsi = /** @type {!TimelineSegmentIndex} */(segmentIndex);
tsi.appendTemplateInfo(info, periodStart, periodEnd, shouldFit);
tsi.appendTemplateInfo(
info, periodStart, periodEnd, shouldFit, initSegmentReference);

const availabilityStart =
context.presentationTimeline.getSegmentAvailabilityStart();
Expand All @@ -167,7 +168,7 @@ shaka.dash.SegmentTemplate = class {
if (segmentIndex instanceof shaka.dash.TimelineSegmentIndex &&
segmentIndex.isEmpty()) {
segmentIndex.appendTemplateInfo(info, periodStart,
periodEnd, shouldFit);
periodEnd, shouldFit, initSegmentReference);
}
return Promise.resolve(segmentIndex);
},
Expand Down Expand Up @@ -684,15 +685,20 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
* @param {number} periodStart
* @param {number} periodEnd
* @param {boolean} shouldFit
* @param {shaka.media.InitSegmentReference} initSegmentReference
*/
appendTemplateInfo(info, periodStart, periodEnd, shouldFit) {
appendTemplateInfo(info, periodStart, periodEnd, shouldFit,
initSegmentReference) {
this.initSegmentReference_ = initSegmentReference;
if (!this.templateInfo_) {
this.templateInfo_ = info;
this.periodStart_ = periodStart;
this.periodEnd_ = periodEnd;
} else {
const currentTimeline = this.templateInfo_.timeline;

this.templateInfo_.mediaTemplate = info.mediaTemplate;

// Append timeline
const lastCurrentEntry = currentTimeline[currentTimeline.length - 1];
const newEntries = info.timeline.filter((entry) => {
Expand Down

0 comments on commit a61538a

Please sign in to comment.