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

Multiple audio languages with encryption #112

Closed
ruiposse opened this issue Jun 24, 2015 · 17 comments
Closed

Multiple audio languages with encryption #112

ruiposse opened this issue Jun 24, 2015 · 17 comments
Assignees
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@ruiposse
Copy link

Hi, in my tests I've been trying to get Shaka Player to work with multiple encrypted audio.

In eme_manager.js, chooseEncrypted_ has the following code starting on line 345:

for (var j = 0; j < configs.length; ++j) {
      var cfg = configs[j];
      if (cfg.drmScheme.keySystem == keySystem &&
          cfg.fullMimeType == caps.contentType) {
        chosenCfgs.push(cfg);

        // Accumulate the DRM scheme info from all chosen StreamConfigs.
        if (!this.drmScheme_) {
          this.drmScheme_ = cfg.drmScheme;
        } else {
          var newScheme = /** @type {!shaka.player.DrmSchemeInfo} */(
              cfg.drmScheme);
          shaka.player.DrmSchemeInfo.combine(this.drmScheme_, newScheme);
        }
        break;
      }
    }

Not sure if this is a bug, but what seems to happen is that whenever there's more than one audio in the manifest, Shaka Player loops through them until it finds the first one that matches the supported drmScheme even thought it knows that there's more audio tracks that could be tested.

I've found that removing the break; fixes this issue.
Not sure if that's the proper solution, but I figure this could be a start :)

@sanbornhilland
Copy link
Contributor

+1

I have the same issue and this fixes the problem.

EDIT: It only partially fixes the problem. EX: If you have a manifest that has an english audio track and a french audio track but both of them are protected with Widevine and Playready then by only removing the break statement it ends up listing 4 audio tracks when in fact there are only 2 audio tracks available with the supported encryption.

@joeyparrish joeyparrish self-assigned this Jun 25, 2015
@joeyparrish
Copy link
Member

Thanks for the report. Can either of you supply test content I could use to reproduce and debug the problem? If it's something you can't post in public, an email would be fine.

@joeyparrish joeyparrish added the type: bug Something isn't working correctly label Jun 26, 2015
@ruiposse
Copy link
Author

ruiposse commented Jul 1, 2015

Unfortunately I cannot. All content is behind an authentication system.
Sorry about that. I know it's not very useful, but I'm pretty sure it happens with any manifest with more than one audio.

@joeyparrish joeyparrish changed the title Multiple audio Multiple audio languages with encryption Jul 1, 2015
@joeyparrish joeyparrish added this to the v1.5.0 milestone Jul 1, 2015
@sanbornhilland
Copy link
Contributor

I've emailed @joeyparrish with some test content that should reproduce the issue.

@joeyparrish
Copy link
Member

I can now reproduce the issue. I'll see what I can do to fix it. Thanks!

@joeyparrish
Copy link
Member

@sanbornhnewyyz, I can't reproduce the behavior in your earlier comment, where removing the break statement results in too many tracks.

In the test content you gave me, there are two audio languages, one audio bitrate per language, and three ContentProtections elements. I added a check for PlayReady to app.interpretContentProtection_ in case it was important to have multiple DrmSchemeInfos as well. With this setup, if I remove the break in chooseEncrypted_, I get exactly two audio tracks.

If I edit the manifest and add an additional audio Representation to each AdaptationSet (low bandwidth such that they are not selected by default), I now see four audio tracks as I would expect. I can't seem to get them to duplicate per-ContentProtection or per-DrmSchemeInfo. So for the moment, it seems as if removing the break statement is, in fact, the correct fix.

Is there something I'm missing to reproduce the "too many tracks" problem you described?

@sanbornhilland
Copy link
Contributor

No, as far as I know I just removed that break statement.

@joeyparrish
Copy link
Member

Did some archaeology: It seems this bug has always been there, ever since we started using requestMediaKeySystemAccess back in February (a253872).

Removing the break statement seems to me to be the correct fix. You should be able to choose all matches for key system & codec. The content from Sanborn that I've tested seems to be fixed by this.

Are there any objections to this fix? Or counter-examples where it does not work as it should?

@sanbornhilland
Copy link
Contributor

I have no objections.

@joeyparrish joeyparrish modified the milestones: v1.4.0, v1.5.0 Jul 6, 2015
joeyparrish added a commit that referenced this issue Jul 6, 2015
EmeManager should not stop at the first match, since this results in
only one language for multi-lingual content.

Fixes #112

Change-Id: I90109f53e4da38ac0fddc67476b7caab0c852381
@sanbornhilland
Copy link
Contributor

I hate to do this but I actually still am having a problem with 1.4.0. When I call player.getAudioTracks() it returns 8 tracks instead of 2. But there are actually only 2 different tracks in the array and each of them is repeated 4 times. Am I failing to specify somewhere that I only want tracks with widevine protection?

@joeyparrish
Copy link
Member

No worries! We want to get this solved for you. Does this happen with the last sample you sent me, or will I need a new sample to reproduce?

@joeyparrish joeyparrish reopened this Jul 7, 2015
@sanbornhilland
Copy link
Contributor

It should work with the last sample I sent you but I was going to verify it. I'm having trouble playing the content in the sample app. Can you still play the content that I sent?

@joeyparrish
Copy link
Member

Yes, I can play it in the test app. I just paste the URLs you gave me into the test app's manifest and license server fields.

@sanbornhilland
Copy link
Contributor

Okay after some further examination it turns out the problem was caused by our incorrect contentProtection callback (thanks for the tipoff). We were ignoring schemeIdUri and just returning a DrmSchemeInfo instance every time and this caused it to think there were more tracks than there really were. After this change, the fix you put into 1.4.0 works perfectly.

Thanks for the help.

@joeyparrish
Copy link
Member

No problem. I'll try to replicate that and see if this is something we should account for somehow when processing the callback's results.

@joeyparrish
Copy link
Member

Looks like something we can/should take care of in EmeManager. I've got a fix in review internally that seems to handle duplicate DrmSchemeInfos more gracefully. Thanks for helping me repro it.

@sanbornhilland
Copy link
Contributor

Great, thanks for the fix.

joeyparrish added a commit that referenced this issue Jul 31, 2015
This is a more thorough fix for multiple encrypted audio tracks.

Rather than taking all matches for key system and codec, take one
match per AdaptationSet.  Now if there are multiple usable
DrmSchemeInfos for the same language, only one will be chosen per
language.

This makes the system more resiliant to ContentProtection callbacks
that ignore all input and return the same DrmSchemeInfo no matter
what.

Fixes #112

Change-Id: I9ed37ba1afdaec6bb5d8abaf285cb36b6e2a3db6
@shaka-project shaka-project locked and limited conversation to collaborators Mar 22, 2018
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

5 participants