Skip to content

Commit

Permalink
Work around a bug in the Android 13 ClearKey implementation
Browse files Browse the repository at this point in the history
The ClearKey CDM will attach an 'invalid' URL in `KeyRequest` objects,
when the documentation states this should be an empty string if a
default URL is not known.

#minor-release

PiperOrigin-RevId: 476113513
  • Loading branch information
icbaker authored and marcbaechinger committed Sep 30, 2022
1 parent 9ccdd22 commit 715c948
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
3 changes: 3 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
`MetadataRenderer(MetadataOutput, Looper, MetadataDecoderFactory,
boolean)` to specify whether the renderer will output metadata early or
in sync with the player position.
* DRM:
* Work around a bug in the Android 13 ClearKey implementation that returns
a non-empty but invalid license URL.
* DASH:
* Parse `EventStream.presentationTimeOffset` from manifests
([#10460](https://github.com/google/ExoPlayer/issues/10460)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,7 @@ public KeyRequest getKeyRequest(
mediaDrm.getKeyRequest(scope, initData, mimeType, keyType, optionalParameters);

byte[] requestData = adjustRequestData(uuid, request.getData());

String licenseServerUrl = request.getDefaultUrl();
if (MOCK_LA_URL_VALUE.equals(licenseServerUrl)) {
licenseServerUrl = "";
}
String licenseServerUrl = adjustLicenseServerUrl(request.getDefaultUrl());
if (TextUtils.isEmpty(licenseServerUrl)
&& schemeData != null
&& !TextUtils.isEmpty(schemeData.licenseServerUrl)) {
Expand All @@ -247,6 +243,17 @@ public KeyRequest getKeyRequest(
return new KeyRequest(requestData, licenseServerUrl, requestType);
}

private static String adjustLicenseServerUrl(String licenseServerUrl) {
if (MOCK_LA_URL.equals(licenseServerUrl)) {
return "";
} else if (Util.SDK_INT == 33 && "https://default.url".equals(licenseServerUrl)) {
// Work around b/247808112
return "";
} else {
return licenseServerUrl;
}
}

@UnstableApi
@Override
@Nullable
Expand Down

0 comments on commit 715c948

Please sign in to comment.