Clean up ClearKey UUIDs
- There is a proper ClearKey UUID now. This change requires it to be used instead of the Common PSSH UUID when instantiating DRM components. - Internally, we'll map the ClearKey UUID onto the Common PSSH UUID where necessary to (a) access the ClearKey CDM on older devices, and (b) access drm init data stored under the Common PSSH UUID in the stream. Issue: #3138 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=164839213
This commit is contained in:
parent
2d0044fee4
commit
5ab0c620bf
@ -271,7 +271,7 @@ public class SampleChooserActivity extends Activity {
|
||||
return C.WIDEVINE_UUID;
|
||||
case "playready":
|
||||
return C.PLAYREADY_UUID;
|
||||
case "cenc":
|
||||
case "clearkey":
|
||||
return C.CLEARKEY_UUID;
|
||||
default:
|
||||
try {
|
||||
|
@ -604,12 +604,19 @@ public final class C {
|
||||
*/
|
||||
public static final UUID UUID_NIL = new UUID(0L, 0L);
|
||||
|
||||
/**
|
||||
* UUID for the W3C
|
||||
* <a href="https://w3c.github.io/encrypted-media/format-registry/initdata/cenc.html">Common PSSH
|
||||
* box</a>.
|
||||
*/
|
||||
public static final UUID COMMON_PSSH_UUID = new UUID(0x1077EFECC0B24D02L, 0xACE33C1E52E2FB4BL);
|
||||
|
||||
/**
|
||||
* UUID for the ClearKey DRM scheme.
|
||||
* <p>
|
||||
* ClearKey is supported on Android devices running Android 5.0 (API Level 21) and up.
|
||||
*/
|
||||
public static final UUID CLEARKEY_UUID = new UUID(0x1077EFECC0B24D02L, 0xACE33C1E52E2FB4BL);
|
||||
public static final UUID CLEARKEY_UUID = new UUID(0xE2719D58A985B3C9L, 0x781AB030AF78D30EL);
|
||||
|
||||
/**
|
||||
* UUID for the Widevine DRM scheme.
|
||||
|
@ -216,6 +216,8 @@ public class DefaultDrmSessionManager<T extends ExoMediaCrypto> implements DrmSe
|
||||
public DefaultDrmSessionManager(UUID uuid, ExoMediaDrm<T> mediaDrm, MediaDrmCallback callback,
|
||||
HashMap<String, String> optionalKeyRequestParameters, Handler eventHandler,
|
||||
EventListener eventListener) {
|
||||
Assertions.checkNotNull(uuid);
|
||||
Assertions.checkArgument(!C.COMMON_PSSH_UUID.equals(uuid), "Use C.CLEARKEY_UUID instead");
|
||||
this.uuid = uuid;
|
||||
this.mediaDrm = mediaDrm;
|
||||
this.callback = callback;
|
||||
@ -346,6 +348,10 @@ public class DefaultDrmSessionManager<T extends ExoMediaCrypto> implements DrmSe
|
||||
|
||||
if (offlineLicenseKeySetId == null) {
|
||||
SchemeData schemeData = drmInitData.get(uuid);
|
||||
if (schemeData == null && C.CLEARKEY_UUID.equals(uuid)) {
|
||||
// If present, the Common PSSH box should be used for ClearKey.
|
||||
schemeData = drmInitData.get(C.COMMON_PSSH_UUID);
|
||||
}
|
||||
if (schemeData == null) {
|
||||
onError(new IllegalStateException("Media does not support uuid: " + uuid));
|
||||
return this;
|
||||
|
@ -57,7 +57,13 @@ public final class FrameworkMediaDrm implements ExoMediaDrm<FrameworkMediaCrypto
|
||||
}
|
||||
|
||||
private FrameworkMediaDrm(UUID uuid) throws UnsupportedSchemeException {
|
||||
this.mediaDrm = new MediaDrm(Assertions.checkNotNull(uuid));
|
||||
Assertions.checkNotNull(uuid);
|
||||
Assertions.checkArgument(!C.COMMON_PSSH_UUID.equals(uuid), "Use C.CLEARKEY_UUID instead");
|
||||
if (Util.SDK_INT < 27 && C.CLEARKEY_UUID.equals(uuid)) {
|
||||
// ClearKey had to be accessed using the Common PSSH UUID prior to API level 27.
|
||||
uuid = C.COMMON_PSSH_UUID;
|
||||
}
|
||||
this.mediaDrm = new MediaDrm(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user