Skip to content

Commit

Permalink
Fix an issue that causes DRM capabilities being compared to non DRM c…
Browse files Browse the repository at this point in the history
…apabilities
  • Loading branch information
dsilhavy committed Nov 29, 2024
1 parent dc94fe4 commit d49a1d5
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/streaming/utils/Capabilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,27 @@ function Capabilities() {
}

return testedCodecConfigurations.find((current) => {
const audioEqual = configuration && configuration.audio ? objectUtils.areEqual(configuration.audio, current.audio) : true;
const videoEqual = configuration && configuration.video ? objectUtils.areEqual(configuration.video, current.video) : true;
const keySystemEqual = configuration && configuration.keySystemConfiguration ? objectUtils.areEqual(configuration.keySystemConfiguration, current.keySystemConfiguration) : true;
const audioEqual = _isConfigEqual(configuration, current, Constants.AUDIO);
const videoEqual = _isConfigEqual(configuration, current, Constants.VIDEO);
const keySystemEqual = _isConfigEqual(configuration, current, 'keySystemConfiguration');

return audioEqual && videoEqual && keySystemEqual
})
}

function _isConfigEqual(configuration, current, attribute) {

// Config not present in both of them
if (!configuration[attribute] && !current[attribute]) {
return true
}

// Config present in both we need to compare
if (configuration[attribute] && current[attribute]) {
return objectUtils.areEqual(configuration[attribute], current[attribute])
}

return false
}

function _getGenericMediaCapabilitiesVideoConfig(inputConfig) {
Expand Down

0 comments on commit d49a1d5

Please sign in to comment.