Skip to content

Commit 4df22d2

Browse files
cdatehortuabjoeyparrish
authored andcommitted
fix(DASH): decrease memory preasure on manifest with SegmentReference by updating old initSegmentReference (shaka-project#6499)
Helps on shaka-project#6070 Backported to v4.7.x
1 parent daa47f1 commit 4df22d2

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Bonnier Broadcasting <*@bonnierbroadcasting.com>
2828
Bryan Huh <[email protected]>
2929
Charter Communications Inc <*@charter.com>
3030
Code It <*@code-it.fr>
31+
Cristian Atehortua <[email protected]>
3132
Damien Deis <[email protected]>
3233
Dany L'Hébreux <[email protected]>
3334
Dave Nicholas <[email protected]>

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Casey Occhialini <[email protected]>
4444
Chad Assareh <[email protected]>
4545
Chris Fillmore <[email protected]>
4646
Costel Madalin Grecu <[email protected]>
47+
Cristian Atehortua <[email protected]>
4748
Damien Deis <[email protected]>
4849
Dany L'Hébreux <[email protected]>
4950
Dave Nicholas <[email protected]>

lib/dash/segment_template.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
694694
*/
695695
appendTemplateInfo(info, periodStart, periodEnd, shouldFit,
696696
initSegmentReference) {
697-
this.initSegmentReference_ = initSegmentReference;
697+
this.updateInitSegmentReference(initSegmentReference);
698698
if (!this.templateInfo_) {
699699
this.templateInfo_ = info;
700700
this.periodStart_ = periodStart;
@@ -725,6 +725,24 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
725725
}
726726
}
727727

728+
/**
729+
* Updates the init segment reference and propagates the update to all
730+
* references.
731+
* @param {shaka.media.InitSegmentReference} initSegmentReference
732+
*/
733+
updateInitSegmentReference(initSegmentReference) {
734+
if (this.initSegmentReference_ === initSegmentReference) {
735+
return;
736+
}
737+
738+
this.initSegmentReference_ = initSegmentReference;
739+
for (const reference of this.references) {
740+
if (reference) {
741+
reference.updateInitSegmentReference(initSegmentReference);
742+
}
743+
}
744+
}
745+
728746
/**
729747
*
730748
* @param {number} time

lib/media/segment_reference.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,18 @@ shaka.media.SegmentReference = class {
586586
this.offset(offset);
587587
}
588588
}
589+
590+
/**
591+
* Updates the init segment reference and propagates the update to all partial
592+
* references.
593+
* @param {shaka.media.InitSegmentReference} initSegmentReference
594+
*/
595+
updateInitSegmentReference(initSegmentReference) {
596+
this.initSegmentReference = initSegmentReference;
597+
for (const partialReference of this.partialReferences) {
598+
partialReference.updateInitSegmentReference(initSegmentReference);
599+
}
600+
}
589601
};
590602

591603

0 commit comments

Comments
 (0)