Skip to content

Commit 6ad7c03

Browse files
Dan SparacioDan Sparacio
Dan Sparacio
authored and
Dan Sparacio
committed
Merge pull request Dash-Industry-Forum#1331 from bbc/repratiobound
Prevent low values attempting to use representation -1
2 parents 7378259 + 4b6fd6a commit 6ad7c03

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/streaming/controllers/AbrController.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ function AbrController() {
141141
let representation = dashManifestModel.getAdaptationForType(manifest, 0, type).Representation;
142142

143143
if (Array.isArray(representation)) {
144-
bitrateDict[type] = representation[Math.round(representation.length * ratioDict[type]) - 1].bandwidth;
144+
let repIdx = Math.max(Math.round(representation.length * ratioDict[type]) - 1, 0);
145+
bitrateDict[type] = representation[repIdx].bandwidth;
145146
} else {
146147
bitrateDict[type] = 0;
147148
}

0 commit comments

Comments
 (0)