Skip to content

Commit 83d22a3

Browse files
matvp91avelad
authored andcommitted
fix(DASH): Update timeline on PTO change (#8869)
Fixes #8351. When we detect a change in `unscaledPresentationTimeOffset`, we'll update the timeline along with both the scaled and unscaled presentationTimeOffset. For reference, updating `templateInfo_` introduced a memory leak a while back (#6610), I ran this change for 2 hours straight and memory was kept in check.
1 parent 4ccecc6 commit 83d22a3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/dash/segment_template.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,12 +855,21 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
855855
this.periodStart_ = periodStart;
856856
this.periodEnd_ = periodEnd;
857857
} else {
858-
const currentTimeline = this.templateInfo_.timeline;
858+
if (this.templateInfo_.unscaledPresentationTimeOffset !==
859+
info.unscaledPresentationTimeOffset) {
860+
this.templateInfo_.timeline = info.timeline;
861+
this.templateInfo_.unscaledPresentationTimeOffset =
862+
info.unscaledPresentationTimeOffset;
863+
this.templateInfo_.scaledPresentationTimeOffset =
864+
info.scaledPresentationTimeOffset;
865+
}
859866

860867
if (this.templateInfo_.mediaTemplate !== info.mediaTemplate) {
861868
this.templateInfo_.mediaTemplate = info.mediaTemplate;
862869
}
863870

871+
const currentTimeline = this.templateInfo_.timeline;
872+
864873
// Append timeline
865874
let newEntries;
866875
if (currentTimeline.length) {

0 commit comments

Comments
 (0)