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(cast): Added existence checks for MediaDecodingConfig.{audio|video} in decodingInfo(). #4796

Merged
merged 1 commit into from
Dec 7, 2022

Conversation

JulianDomingo
Copy link
Collaborator

@JulianDomingo JulianDomingo commented Dec 7, 2022

See #4790.

To be honest, I'm failing to understand how a TypeError can happen here (this is occurring in a Casted Apple Music, non-AES-128 stream, so EME), since:

  1. The problematic code lines aren't reachable unless MediaDecodingConfig.keySystemConfiguration is set.
  2. MediaDecodingConfig.keySystemConfiguration is only set if drmInfos are provided:
    const videoDrmInfos = variant.video ? variant.video.drmInfos : [];
    const audioDrmInfos = variant.audio ? variant.audio.drmInfos : [];
    const allDrmInfos = videoDrmInfos.concat(audioDrmInfos);
    // Return a list containing the mediaDecodingConfig for unencrypted variant.
    if (!allDrmInfos.length) {
    return [mediaDecodingConfig];
    }

during manifest parsing (showing HLS for example):

const keyFormat =
drmTag.getAttributeValue('KEYFORMAT') || 'identity';
const drmParser =
shaka.hls.HlsParser.KEYFORMATS_TO_DRM_PARSERS_[keyFormat];
const drmInfo = drmParser ?
drmParser(drmTag, /* mimeType= */ '') : null;
if (drmInfo) {
if (drmInfo.keyIds) {
for (const keyId of drmInfo.keyIds) {
keyIds.add(keyId);
}
}
drmInfos.push(drmInfo);

Regardless, requestMediaKeySystemAccess() will never report a variant is supported if contentType is null/empty string (as per https://w3c.github.io/encrypted-media/#get-supported-capabilities-for-audio-video-type). So the polyfill implementation behaves the same as before this change.

@JulianDomingo JulianDomingo added type: bug Something isn't working correctly priority: P1 Big impact or workaround impractical; resolve before feature release platform: Cast Issues affecting Cast devices labels Dec 7, 2022
@JulianDomingo JulianDomingo added this to the v4.4 milestone Dec 7, 2022
@JulianDomingo JulianDomingo self-assigned this Dec 7, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2022

Incremental code coverage: 100.00%

@JulianDomingo JulianDomingo merged commit 36db83d into shaka-project:main Dec 7, 2022
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Jul 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform: Cast Issues affecting Cast devices priority: P1 Big impact or workaround impractical; resolve before feature release status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants