From 8d2b6574de6d0510ae752637c3507df93fbf3591 Mon Sep 17 00:00:00 2001 From: Albin Larsson Date: Thu, 2 Nov 2023 09:23:01 +0100 Subject: [PATCH] fix(dash): fix race condition in segment template (#5842) Fixes https://github.com/shaka-project/shaka-player/issues/5760 --- lib/dash/segment_template.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/dash/segment_template.js b/lib/dash/segment_template.js index 059e06b5ef..d1bac66f08 100644 --- a/lib/dash/segment_template.js +++ b/lib/dash/segment_template.js @@ -813,18 +813,16 @@ 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 = position + this.templateInfo_.startNumber; const timeReplacement = this.templateInfo_ .unscaledPresentationTimeOffset + range.unscaledStart; const createUrisCb = () => { - if (!this.templateInfo_) { - return []; - } return shaka.dash.TimelineSegmentIndex .createUris_( - this.templateInfo_.mediaTemplate, + mediaTemplate, this.representationId_, segmentReplacement, this.bandwidth_,