Skip to content

Commit 9cb12cc

Browse files
authored
Feature/processing optimizations (Dash-Industry-Forum#4609)
* Remove EssentialProperty from ObjectIron RepresentationMap and account for EssentialProperties not automatically being mapped to Representation * Remove SupplementalProperty from ObjectIron RepresentationMap and account for SupplementalProperty not automatically being mapped to Representation * Adjust the Karma config for unit tests to derive code coverage * Fix a bug that causes SegmentBase playback to crash
1 parent fdf3308 commit 9cb12cc

15 files changed

+517
-308
lines changed

package-lock.json

Lines changed: 213 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"@chiragrupani/karma-chromium-edge-launcher": "^2.4.1",
3434
"@eslint/js": "^9.13.0",
3535
"babel-loader": "^9.1.3",
36+
"babel-plugin-istanbul": "^7.0.0",
3637
"chai": "^4.4.1",
3738
"chai-spies": "^1.1.0",
3839
"clean-jsdoc-theme": "^4.2.17",

src/dash/DashAdapter.js

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,19 @@ function DashAdapter() {
387387
return dashManifestModel.getProducerReferenceTimesForAdaptation(realAdaptation);
388388
}
389389

390+
/**
391+
* Return all EssentialProperties of an AdaptationSet
392+
* @param {object} adaptationSet
393+
* @return {array}
394+
*/
395+
function getEssentialPropertiesForAdaptationSet(adaptationSet) {
396+
try {
397+
return dashManifestModel.getEssentialPropertiesForRepresentation(adaptationSet);
398+
} catch (e) {
399+
return [];
400+
}
401+
}
402+
390403
/**
391404
* Return all EssentialProperties of a Representation
392405
* @param {object} representation
@@ -1013,15 +1026,8 @@ function DashAdapter() {
10131026
}
10141027

10151028
mediaInfo.isText = dashManifestModel.getIsText(realAdaptation);
1016-
mediaInfo.essentialProperties = dashManifestModel.getEssentialPropertiesForAdaptation(realAdaptation);
1017-
if ((!mediaInfo.essentialProperties || mediaInfo.essentialProperties.length === 0) && realAdaptation.Representation && realAdaptation.Representation.length > 0) {
1018-
mediaInfo.essentialProperties = _getCommonRepresentationEssentialProperties(realAdaptation);
1019-
}
1029+
mediaInfo.essentialProperties = dashManifestModel.getEssentialPropertiesForAdaptationSet(realAdaptation);
10201030
mediaInfo.supplementalProperties = dashManifestModel.getSupplementalPropertiesForAdaptation(realAdaptation);
1021-
if ((!mediaInfo.supplementalProperties || mediaInfo.supplementalProperties.length === 0) && realAdaptation.Representation && realAdaptation.Representation.length > 0) {
1022-
mediaInfo.supplementalProperties = _getCommonRepresentationSupplementalProperties(realAdaptation);
1023-
}
1024-
10251031
mediaInfo.isFragmented = dashManifestModel.getIsFragmented(realAdaptation);
10261032
mediaInfo.isEmbedded = false;
10271033
mediaInfo.adaptationSetSwitchingCompatibleIds = _getAdaptationSetSwitchingCompatibleIds(mediaInfo);
@@ -1080,32 +1086,6 @@ function DashAdapter() {
10801086
return normalizedKeyIds
10811087
}
10821088

1083-
function _getCommonRepresentationEssentialProperties(realAdaptation) {
1084-
let arr = realAdaptation.Representation.map(repr => {
1085-
return dashManifestModel.getEssentialPropertiesForRepresentation(repr);
1086-
});
1087-
1088-
if (arr.every(v => JSON.stringify(v) === JSON.stringify(arr[0]))) {
1089-
// only output Representation.essentialProperties to mediaInfo, if they are present on all Representations
1090-
return arr[0];
1091-
}
1092-
1093-
return []
1094-
}
1095-
1096-
function _getCommonRepresentationSupplementalProperties(realAdaptation) {
1097-
let arr = realAdaptation.Representation.map(repr => {
1098-
return dashManifestModel.getSupplementalPropertiesForRepresentation(repr);
1099-
});
1100-
1101-
if (arr.every(v => JSON.stringify(v) === JSON.stringify(arr[0]))) {
1102-
// only output Representation.supplementalProperties to mediaInfo, if they are present on all Representations
1103-
return arr[0];
1104-
}
1105-
1106-
return []
1107-
}
1108-
11091089
function _getAdaptationSetSwitchingCompatibleIds(mediaInfo) {
11101090
if (!mediaInfo || !mediaInfo.supplementalProperties) {
11111091
return []
@@ -1228,6 +1208,7 @@ function DashAdapter() {
12281208
getCodec,
12291209
getContentSteering,
12301210
getDuration,
1211+
getEssentialPropertiesForAdaptationSet,
12311212
getEssentialPropertiesForRepresentation,
12321213
getEvent,
12331214
getEventsFor,

src/dash/SegmentBaseLoader.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ function SegmentBaseLoader() {
128128
searching: false,
129129
bytesLoaded: 0,
130130
bytesToLoad: 1500,
131-
mediaType: mediaType
131+
mediaType: mediaType,
132+
representation
132133
};
133134

134135
logger.debug('Start searching for initialization.');
@@ -183,7 +184,8 @@ function SegmentBaseLoader() {
183184
searching: !hasRange,
184185
bytesLoaded: loadingInfo ? loadingInfo.bytesLoaded : 0,
185186
bytesToLoad: 1500,
186-
mediaType: mediaType
187+
mediaType: mediaType,
188+
representation
187189
};
188190

189191
const request = getFragmentRequest(info);

0 commit comments

Comments
 (0)