From ffdf4c8baec5cf58164dfcd9391c1bfea196b2ac Mon Sep 17 00:00:00 2001 From: dsilhavy Date: Mon, 27 Jun 2022 16:32:17 +0200 Subject: [PATCH] Fix _checkPortalSize and initialRatio caluculation for unsorted Representations in an AS --- src/streaming/controllers/AbrController.js | 4 ++-- test/unit/mocks/AdapterMock.js | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/streaming/controllers/AbrController.js b/src/streaming/controllers/AbrController.js index 6bf9bd5212..3bf7ff9009 100644 --- a/src/streaming/controllers/AbrController.js +++ b/src/streaming/controllers/AbrController.js @@ -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) { @@ -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; diff --git a/test/unit/mocks/AdapterMock.js b/test/unit/mocks/AdapterMock.js index c36f0147e6..3e9b2a43ff 100644 --- a/test/unit/mocks/AdapterMock.js +++ b/test/unit/mocks/AdapterMock.js @@ -79,6 +79,23 @@ function AdapterMock() { { width: 900 } + ], + Representation_asArray: [ + { + width: 500 + }, + { + width: 750 + }, + { + width: 900 + }, + { + width: 900 + }, + { + width: 900 + } ] }; };