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

fix: Multivariant HLS manifests don't work with DRM #7775

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gmcgarry
Copy link
Contributor

@gmcgarry gmcgarry commented Dec 18, 2024

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_():

    if (variants.length == 1) {
      const createSegmentIndexPromises = [];
      const variant = variants[0];
      for (const stream of [variant.video, variant.audio]) {
        if (stream && !stream.segmentIndex) {
          createSegmentIndexPromises.push(stream.createSegmentIndex());
        }
      }
      if (createSegmentIndexPromises.length > 0) {
        await Promise.all(createSegmentIndexPromises);
      }
    }

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.

…T-X-KEY attribute to get the variant drmInfos early.
@shaka-bot
Copy link
Collaborator

Incremental code coverage: 100.00%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants