Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update AudioChannelConfiguration management #3044

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/dash/DashAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,12 @@ function DashAdapter() {
mediaInfo.audioChannelConfiguration = dashManifestModel.getAudioChannelConfigurationForAdaptation(realAdaptation).map(function (audioChannelConfiguration) {
return audioChannelConfiguration.value;
});

if (mediaInfo.audioChannelConfiguration.length === 0 && Array.isArray(realAdaptation.Representation_asArray) && realAdaptation.Representation_asArray.length > 0 ) {
mediaInfo.audioChannelConfiguration = dashManifestModel.getAudioChannelConfigurationForRepresentation(realAdaptation.Representation_asArray[0]).map(function (audioChannelConfiguration) {
return audioChannelConfiguration.value;
});
}
mediaInfo.roles = dashManifestModel.getRolesForAdaptation(realAdaptation).map(function (role) {
return role.value;
});
Expand Down
5 changes: 5 additions & 0 deletions src/dash/models/DashManifestModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ function DashManifestModel() {
return adaptation && adaptation.hasOwnProperty(DashConstants.AUDIOCHANNELCONFIGURATION_ASARRAY) ? adaptation.AudioChannelConfiguration_asArray : [];
}

function getAudioChannelConfigurationForRepresentation(representation) {
return representation && representation.hasOwnProperty(DashConstants.AUDIOCHANNELCONFIGURATION_ASARRAY) ? representation.AudioChannelConfiguration_asArray : [];
}

function getRepresentationSortFunction() {
return (a, b) => a.bandwidth - b.bandwidth;
}
Expand Down Expand Up @@ -1054,6 +1058,7 @@ function DashManifestModel() {
getRolesForAdaptation: getRolesForAdaptation,
getAccessibilityForAdaptation: getAccessibilityForAdaptation,
getAudioChannelConfigurationForAdaptation: getAudioChannelConfigurationForAdaptation,
getAudioChannelConfigurationForRepresentation: getAudioChannelConfigurationForRepresentation,
getAdaptationForIndex: getAdaptationForIndex,
getIndexForAdaptation: getIndexForAdaptation,
getAdaptationForId: getAdaptationForId,
Expand Down