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

Multi-Period with mixed encrypted and unencrypted periods #409

Closed
baconz opened this issue Jun 9, 2016 · 1 comment
Closed

Multi-Period with mixed encrypted and unencrypted periods #409

baconz opened this issue Jun 9, 2016 · 1 comment
Assignees
Labels
status: archived Archived and locked; will not be updated type: external An issue with an external dependency; not our issue; sometimes kept open for tracking type: question A question from the community

Comments

@baconz
Copy link
Contributor

baconz commented Jun 9, 2016

I have a multi-period manifest wherein some periods can contain encrypted adaptation sets, and other periods have unencrypted adaptations sets. It seems that filterPeriods lets unencrypted streams through even when a key system has been selected:

      var match = streamSet.drmInfos.length == 0 ||
                  streamSet.drmInfos.some(function(drmInfo) {
                    return drmInfo.keySystem == keySystem; });

I'm not sure if this is by design -- is the sourceBuffer supposed to figure out that a segment is unencrypted if it doesn't have the cenc boxes?

At any rate, right now I get failed fetch and append: code=3015 with Failed to execute 'appendBuffer' on 'SourceBuffer': The HTMLMediaElement.error attribute is not null. when the player tries to append the unencrypted content.

@joeyparrish joeyparrish self-assigned this Jun 9, 2016
@joeyparrish joeyparrish added type: question A question from the community type: external An issue with an external dependency; not our issue; sometimes kept open for tracking labels Jun 9, 2016
@joeyparrish
Copy link
Member

Unencrypted content is allowed by design. Imagine you have a piece of content with encrypted video streams but unencrypted audio. No encrypted AdaptationSets for audio are available. There's no reason this should be disallowed. Note that this filtering based on key system is independent of multi-period considerations.

With multi-period, things get more complicated. In particular, because we must change init segments when we change periods.

An encrypted stream can have unencrypted blocks. You can package the first several seconds in the clear to allow time for license acquisition, for example. The init segment still indicates that the content is encrypted, and as I understand it, the browser's media stack can tell that individual segments are or are not encrypted and decrypt them as needed.

So in theory, there should be no issue with initializing the decoder for encrypted content, then appending unencrypted content. If your first period was encrypted and the second period clear, one could easily imagine a browser that could still decode this.

Chrome, however, does not support changing from encrypted to unencrypted (or vice-versa). When the init segment for the second period is appended, Chrome rejects it. chrome://media-internals will show something like "audio encryption changes not allowed". We reported this in http://crbug.com/597443 and were told that this is working-as-intended for Chrome.

Shaka has no way to detect if a given browser supports this scenario or not, so there's no simple way to reject the content on browsers that can't play it. We could disallow this completely, but some other browsers do support it.

If this is something you need, my recommendation is that you report the issue to Chrome and detail why support for this is important to your application. Feel free to reference the existing crbug and/or this github issue for history.

@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: external An issue with an external dependency; not our issue; sometimes kept open for tracking type: question A question from the community
Projects
None yet
Development

No branches or pull requests

3 participants