Skip to content

Commit

Permalink
getRepresentationsForAdaptation optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Gontran-Molotov committed Feb 28, 2018
1 parent 25f38ef commit 2945b90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/dash/models/DashManifestModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ function DashManifestModel(config) {
isInteger(index) ? adaptation.Representation_asArray[index] : null;
}

function getRepresentationsForAdaptation(voAdaptation) {
function getRepresentationsForAdaptation(voAdaptation, maxRepresentations) {
const voRepresentations = [];
let voRepresentation,
initialization,
Expand All @@ -410,7 +410,10 @@ function DashManifestModel(config) {
}

if (processedRealAdaptation && processedRealAdaptation.Representation_asArray) {
for (i = 0; processedRealAdaptation && i < processedRealAdaptation.Representation_asArray.length; i++) {
if (!maxRepresentations) {
maxRepresentations = processedRealAdaptation.Representation_asArray.length;
}
for (i = 0; i < maxRepresentations; ++i) {
realRepresentation = processedRealAdaptation.Representation_asArray[i];
voRepresentation = new Representation();
voRepresentation.index = i;
Expand Down
2 changes: 1 addition & 1 deletion src/streaming/controllers/StreamController.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ function StreamController() {

if (mediaInfo) {
voAdaptation = adapter.getDataForMedia(mediaInfo);
useCalculatedLiveEdgeTime = dashManifestModel.getRepresentationsForAdaptation(voAdaptation)[0].useCalculatedLiveEdgeTime;
useCalculatedLiveEdgeTime = dashManifestModel.getRepresentationsForAdaptation(voAdaptation, 1)[0].useCalculatedLiveEdgeTime;

if (useCalculatedLiveEdgeTime) {
log('SegmentTimeline detected using calculated Live Edge Time');
Expand Down

0 comments on commit 2945b90

Please sign in to comment.