Skip to content

Commit

Permalink
fix(DASH): Improve memory usage with live streams (#7039)
Browse files Browse the repository at this point in the history
Related to #6610
  • Loading branch information
avelad committed Jul 15, 2024
1 parent 8fc144a commit c1480c7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/dash/segment_template.js
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,9 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
} else {
const currentTimeline = this.templateInfo_.timeline;

this.templateInfo_.mediaTemplate = info.mediaTemplate;
if (this.templateInfo_.mediaTemplate !== info.mediaTemplate) {
this.templateInfo_.mediaTemplate = info.mediaTemplate;
}

// Append timeline
let newEntries;
Expand Down Expand Up @@ -917,7 +919,6 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
let ref = this.references[correctedPosition];

if (!ref) {
const mediaTemplate = this.templateInfo_.mediaTemplate;
const range = this.templateInfo_.timeline[correctedPosition];
const segmentReplacement = range.segmentPosition;
const timeReplacement = this.templateInfo_
Expand Down Expand Up @@ -987,12 +988,12 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
}

const createUrisCb = () => {
if (range.partialSegments > 0) {
if (range.partialSegments > 0 || !this.templateInfo_) {
return [];
}
return shaka.dash.TimelineSegmentIndex
.createUris_(
mediaTemplate,
this.templateInfo_.mediaTemplate,
this.representationId_,
segmentReplacement,
this.bandwidth_,
Expand Down

0 comments on commit c1480c7

Please sign in to comment.