mirror of
https://github.com/androidx/media.git
synced 2025-05-16 03:59:54 +08:00
Work around a bug in the Android 13 ClearKey implementation
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
This commit is contained in:
parent
cfc0eef24e
commit
331d4d626f
@ -218,11 +218,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
|
||||
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)) {
|
||||
@ -236,6 +232,17 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public byte[] provideKeyResponse(byte[] scope, byte[] response)
|
||||
|
Loading…
x
Reference in New Issue
Block a user