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 (shaka-project#6499)

Helps on shaka-project#6070

Backported to v4.7.x
  • Loading branch information
cdatehortuab authored and joeyparrish committed May 7, 2024
1 parent daa47f1 commit 4df22d2
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 <[email protected]>
Charter Communications Inc <*@charter.com>
Code It <*@code-it.fr>
Cristian Atehortua <[email protected]>
Damien Deis <[email protected]>
Dany L'Hébreux <[email protected]>
Dave Nicholas <[email protected]>
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 <[email protected]>
Chad Assareh <[email protected]>
Chris Fillmore <[email protected]>
Costel Madalin Grecu <[email protected]>
Cristian Atehortua <[email protected]>
Damien Deis <[email protected]>
Dany L'Hébreux <[email protected]>
Dave Nicholas <[email protected]>
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 @@ -694,7 +694,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 @@ -725,6 +725,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 @@ -586,6 +586,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 4df22d2

Please sign in to comment.