Skip to content
This repository was archived by the owner on Jan 16, 2023. It is now read-only.

Commit de9ff5f

Browse files
committed
[MSS] Fix representation's width and height (Dash-Industry-Forum#3539)
* MSS parser: set representation width and height only if available * MSS parser: fix qualities id
1 parent c7bb136 commit de9ff5f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/mss/parser/MssParser.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ function MssParser(config) {
122122
let qualityLevels,
123123
representation,
124124
segments,
125-
i;
125+
i,
126+
index;
126127

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

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

173175
// Map Representation to QualityLevel
174176
representation = mapRepresentation(qualityLevels[i], streamIndex);
@@ -200,12 +202,18 @@ function MssParser(config) {
200202
const representation = {};
201203
const type = streamIndex.getAttribute('Type');
202204
let fourCCValue = null;
205+
let width = null;
206+
let height = null;
203207

204208
representation.id = qualityLevel.Id;
205209
representation.bandwidth = parseInt(qualityLevel.getAttribute('Bitrate'), 10);
206210
representation.mimeType = qualityLevel.mimeType;
207-
representation.width = parseInt(qualityLevel.getAttribute('MaxWidth'), 10);
208-
representation.height = parseInt(qualityLevel.getAttribute('MaxHeight'), 10);
211+
212+
width = parseInt(qualityLevel.getAttribute('MaxWidth'), 10);
213+
height = parseInt(qualityLevel.getAttribute('MaxHeight'), 10);
214+
if (!isNaN(width)) representation.width = width;
215+
if (!isNaN(height)) representation.height = height;
216+
209217

210218
fourCCValue = qualityLevel.getAttribute('FourCC');
211219

0 commit comments

Comments
 (0)