fix: Multivariant HLS manifests don't work with DRM #7775
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For Reference, DASH manifest is: https://content.media24.link/hls/flicker84/playready/manifest.mpd
Problematic HLS manifests:
PlayReady: https://content.media24.link/hls/flicker84/playready/master.m3u8
FairPlay: https://content.media24.link/hls/flicker84/fairplay/master.m3u8
This specifically happened with a test for supplemental codecs, because the implementation of HLS SUPPLEMENTAL-CODECS duplicates the variant for all the supplemental codecs. But the same behaviour could be done by explicitly providing multiple variants in the manifest.
The problematic code is in lib/hls/hls_parser.js, method parseManifest_():
This code will only invoke stream.createSegmentIndex() when one variant is available. If it isn't invoked, then the download of the media manifest is deferred, the EXT-X-KEY in the media manifest is not parsed and the code in shaka.media.PreloadManager.initializeDrmInner() never detects any DrmInfos.
Not sure why this code is only invoked if one variant is available. Maybe an optimisation in the common case, which is now a required code path.