Skip to content

Commit

Permalink
fix(DASH): decrease memory preasure on manifest with SegmentReference…
Browse files Browse the repository at this point in the history
… by updating old initSegmentReference (#6499)

Helps on #6070

Backported to v4.7.x
  • Loading branch information
cdatehortuab authored and joeyparrish committed May 7, 2024
1 parent 7f3e786 commit 3e5f98d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Bonnier Broadcasting <*@bonnierbroadcasting.com>
Bryan Huh <bhh1988@gmail.com>
Charter Communications Inc <*@charter.com>
Code It <*@code-it.fr>
Cristian Atehortua <cristian25a32@gmail.com>
Damien Deis <developer.deis@gmail.com>
Dany L'Hébreux <danylhebreux@gmail.com>
Dave Nicholas <davenicholasuk@gmail.com>
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Casey Occhialini <casey.occhialini@gmail.com>
Chad Assareh <assareh@google.com>
Chris Fillmore <fillmore.chris@gmail.com>
Costel Madalin Grecu <madalin.grecu@adswizz.com>
Cristian Atehortua <cristian25a32@gmail.com>
Damien Deis <developer.deis@gmail.com>
Dany L'Hébreux <danylhebreux@gmail.com>
Dave Nicholas <davenicholasuk@gmail.com>
Expand Down
20 changes: 19 additions & 1 deletion lib/dash/segment_template.js
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
*/
appendTemplateInfo(info, periodStart, periodEnd, shouldFit,
initSegmentReference) {
this.initSegmentReference_ = initSegmentReference;
this.updateInitSegmentReference(initSegmentReference);
if (!this.templateInfo_) {
this.templateInfo_ = info;
this.periodStart_ = periodStart;
Expand Down Expand Up @@ -732,6 +732,24 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
}
}

/**
* Updates the init segment reference and propagates the update to all
* references.
* @param {shaka.media.InitSegmentReference} initSegmentReference
*/
updateInitSegmentReference(initSegmentReference) {
if (this.initSegmentReference_ === initSegmentReference) {
return;
}

this.initSegmentReference_ = initSegmentReference;
for (const reference of this.references) {
if (reference) {
reference.updateInitSegmentReference(initSegmentReference);
}
}
}

/**
*
* @param {number} time
Expand Down
12 changes: 12 additions & 0 deletions lib/media/segment_reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,18 @@ shaka.media.SegmentReference = class {
this.offset(offset);
}
}

/**
* Updates the init segment reference and propagates the update to all partial
* references.
* @param {shaka.media.InitSegmentReference} initSegmentReference
*/
updateInitSegmentReference(initSegmentReference) {
this.initSegmentReference = initSegmentReference;
for (const partialReference of this.partialReferences) {
partialReference.updateInitSegmentReference(initSegmentReference);
}
}
};


Expand Down

0 comments on commit 3e5f98d

Please sign in to comment.