Skip to content

Commit

Permalink
[MSS] Fix representation's width and height (#3539)
Browse files Browse the repository at this point in the history
* MSS parser: set representation width and height only if available

* MSS parser: fix qualities id
  • Loading branch information
Bertrand Berthelot committed Feb 18, 2021
1 parent 75cf1a5 commit 9cadfc2
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/mss/parser/MssParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ function MssParser(config) {
let qualityLevels,
representation,
segments,
i;
i,
index;

const name = streamIndex.getAttribute('Name');
const type = streamIndex.getAttribute('Type');
Expand Down Expand Up @@ -168,7 +169,8 @@ function MssParser(config) {
qualityLevels[i].mimeType = adaptationSet.mimeType;

// Set quality level id
qualityLevels[i].Id = adaptationSet.id + '_' + qualityLevels[i].getAttribute('Index');
index = qualityLevels[i].getAttribute('Index');
qualityLevels[i].Id = adaptationSet.id + ((index !== null) ? ('_' + index) : '');

// Map Representation to QualityLevel
representation = mapRepresentation(qualityLevels[i], streamIndex);
Expand Down Expand Up @@ -200,12 +202,18 @@ function MssParser(config) {
const representation = {};
const type = streamIndex.getAttribute('Type');
let fourCCValue = null;
let width = null;
let height = null;

representation.id = qualityLevel.Id;
representation.bandwidth = parseInt(qualityLevel.getAttribute('Bitrate'), 10);
representation.mimeType = qualityLevel.mimeType;
representation.width = parseInt(qualityLevel.getAttribute('MaxWidth'), 10);
representation.height = parseInt(qualityLevel.getAttribute('MaxHeight'), 10);

width = parseInt(qualityLevel.getAttribute('MaxWidth'), 10);
height = parseInt(qualityLevel.getAttribute('MaxHeight'), 10);
if (!isNaN(width)) representation.width = width;
if (!isNaN(height)) representation.height = height;


fourCCValue = qualityLevel.getAttribute('FourCC');

Expand Down

0 comments on commit 9cadfc2

Please sign in to comment.