Cleanup of CENC support

This commit is contained in:
Oliver Woodman 2017-02-23 14:27:23 +00:00
parent 7e02e58e16
commit 3bb08e58f6
2 changed files with 10 additions and 22 deletions

View File

@ -444,14 +444,15 @@ public final class C {
public static final UUID UUID_NIL = new UUID(0L, 0L); public static final UUID UUID_NIL = new UUID(0L, 0L);
/** /**
* UUID for the PSSH box and MPEG-DASH Content Protection. * UUID for the
* <a href="https://w3c.github.io/encrypted-media/format-registry/initdata/cenc.html">W3C</a>. * <a href="https://w3c.github.io/encrypted-media/format-registry/initdata/cenc.html">CENC DRM
* scheme</a>.
*/ */
public static final UUID CENC_UUID = new UUID(0x1077EFECC0B24D02L, 0xACE33C1E52E2FB4BL); public static final UUID CENC_UUID = new UUID(0x1077EFECC0B24D02L, 0xACE33C1E52E2FB4BL);
/** /**
* UUID for the Widevine DRM scheme. * UUID for the Widevine DRM scheme.
* <p></p> * <p>
* Widevine is supported on Android devices running Android 4.3 (API Level 18) and up. * Widevine is supported on Android devices running Android 4.3 (API Level 18) and up.
*/ */
public static final UUID WIDEVINE_UUID = new UUID(0xEDEF8BA979D64ACEL, 0xA3C827DCD51D21EDL); public static final UUID WIDEVINE_UUID = new UUID(0xEDEF8BA979D64ACEL, 0xA3C827DCD51D21EDL);

View File

@ -103,12 +103,8 @@ public class DefaultDrmSessionManager<T extends ExoMediaCrypto> implements DrmSe
/** Releases an existing offline license. */ /** Releases an existing offline license. */
public static final int MODE_RELEASE = 3; public static final int MODE_RELEASE = 3;
/**
* The format to use when ClearKey encryption.
*/
private static final String CENC_INIT_DATA_FORMAT = "cenc";
private static final String TAG = "OfflineDrmSessionMngr"; private static final String TAG = "OfflineDrmSessionMngr";
private static final String CENC_SCHEME_MIME_TYPE = "cenc";
private static final int MSG_PROVISION = 0; private static final int MSG_PROVISION = 0;
private static final int MSG_KEYS = 1; private static final int MSG_KEYS = 1;
@ -345,20 +341,11 @@ public class DefaultDrmSessionManager<T extends ExoMediaCrypto> implements DrmSe
schemeInitData = psshData; schemeInitData = psshData;
} }
} }
if (C.CENC_UUID.equals(uuid)) { if (Util.SDK_INT < 26 && C.CENC_UUID.equals(uuid)
// If "video/mp4" and "audio/mp4" are not supported as CENC schema, change it to "cenc". && (MimeTypes.VIDEO_MP4.equals(schemeMimeType)
// Before 7.1.x in API 25, "video/mp4" and "audio/mp4" are not supported. || MimeTypes.AUDIO_MP4.equals(schemeMimeType))) {
if (MimeTypes.VIDEO_MP4.equals(schemeMimeType) || MimeTypes.AUDIO_MP4.equals( // Prior to API level 26 the CDM only accepted "cenc" as the scheme mime type.
schemeMimeType)) { schemeMimeType = CENC_SCHEME_MIME_TYPE;
if (Util.SDK_INT >= 26) {
// Nothing to do.
} else if (Util.SDK_INT == 25 && !MediaDrm.isCryptoSchemeSupported(uuid,
schemeMimeType)) {
schemeMimeType = CENC_INIT_DATA_FORMAT;
} else if (Util.SDK_INT <= 24) {
schemeMimeType = CENC_INIT_DATA_FORMAT;
}
}
} }
} }
state = STATE_OPENING; state = STATE_OPENING;