Skip to content

Commit

Permalink
Fix _checkPortalSize and initialRatio caluculation for unsorted Repre…
Browse files Browse the repository at this point in the history
…sentations in an AS (#3970)
  • Loading branch information
dsilhavy authored Jun 28, 2022
1 parent d7cc9b8 commit f9f3623
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/streaming/controllers/AbrController.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ function AbrController() {
setElementSize();
}
const streamInfo = streamProcessorDict[streamId][type].getStreamInfo();
const representation = adapter.getAdaptationForType(streamInfo.index, type, streamInfo).Representation;
const representation = adapter.getAdaptationForType(streamInfo.index, type, streamInfo).Representation_asArray;
let newIdx = idx;

if (elementWidth > 0 && elementHeight > 0) {
Expand Down Expand Up @@ -557,7 +557,7 @@ function AbrController() {
if (configBitrate === -1) {
if (configRatio > -1) {
const streamInfo = streamProcessorDict[streamId][type].getStreamInfo();
const representation = adapter.getAdaptationForType(streamInfo.index, type, streamInfo).Representation;
const representation = adapter.getAdaptationForType(streamInfo.index, type, streamInfo).Representation_asArray;
if (Array.isArray(representation)) {
const repIdx = Math.max(Math.round(representation.length * configRatio) - 1, 0);
configBitrate = representation[repIdx].bandwidth / 1000;
Expand Down
17 changes: 17 additions & 0 deletions test/unit/mocks/AdapterMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,23 @@ function AdapterMock() {
{
width: 900
}
],
Representation_asArray: [
{
width: 500
},
{
width: 750
},
{
width: 900
},
{
width: 900
},
{
width: 900
}
]
};
};
Expand Down

0 comments on commit f9f3623

Please sign in to comment.