Skip to content

Commit ff34d1c

Browse files
authored
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 60cb17d commit ff34d1c

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
@@ -913,12 +913,21 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
913913
this.periodStart_ = periodStart;
914914
this.periodEnd_ = periodEnd;
915915
} else {
916-
const currentTimeline = this.templateInfo_.timeline;
916+
if (this.templateInfo_.unscaledPresentationTimeOffset !==
917+
info.unscaledPresentationTimeOffset) {
918+
this.templateInfo_.timeline = info.timeline;
919+
this.templateInfo_.unscaledPresentationTimeOffset =
920+
info.unscaledPresentationTimeOffset;
921+
this.templateInfo_.scaledPresentationTimeOffset =
922+
info.scaledPresentationTimeOffset;
923+
}
917924

918925
if (this.templateInfo_.mediaTemplate !== info.mediaTemplate) {
919926
this.templateInfo_.mediaTemplate = info.mediaTemplate;
920927
}
921928

929+
const currentTimeline = this.templateInfo_.timeline;
930+
922931
// Append timeline
923932
let newEntries;
924933
if (currentTimeline.length) {

0 commit comments

Comments
 (0)