Fix mapping CLEARKEY_UUID to COMMON_PSSH_UUID
This mapping when we call into platform components also needs to be applied when creating the MediaCrypto instance. The fix is to stop propagating the UUID through all the createMediaCrypto methods. This is unnecessary, since the eventual target already knows its own UUID! Issue: #3138 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=166843372
This commit is contained in:
parent
3e76227006
commit
f44e30c754
@ -226,7 +226,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
sessionId = mediaDrm.openSession();
|
sessionId = mediaDrm.openSession();
|
||||||
mediaCrypto = mediaDrm.createMediaCrypto(uuid, sessionId);
|
mediaCrypto = mediaDrm.createMediaCrypto(sessionId);
|
||||||
state = STATE_OPENED;
|
state = STATE_OPENED;
|
||||||
return true;
|
return true;
|
||||||
} catch (NotProvisionedException e) {
|
} catch (NotProvisionedException e) {
|
||||||
|
@ -60,7 +60,7 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
|
|||||||
if (cloneSchemeDatas) {
|
if (cloneSchemeDatas) {
|
||||||
schemeDatas = schemeDatas.clone();
|
schemeDatas = schemeDatas.clone();
|
||||||
}
|
}
|
||||||
// Sorting ensures that universal scheme data(i.e. data that applies to all schemes) is matched
|
// Sorting ensures that universal scheme data (i.e. data that applies to all schemes) is matched
|
||||||
// last. It's also required by the equals and hashcode implementations.
|
// last. It's also required by the equals and hashcode implementations.
|
||||||
Arrays.sort(schemeDatas, this);
|
Arrays.sort(schemeDatas, this);
|
||||||
// Check for no duplicates.
|
// Check for no duplicates.
|
||||||
|
@ -22,7 +22,6 @@ import android.media.NotProvisionedException;
|
|||||||
import android.media.ResourceBusyException;
|
import android.media.ResourceBusyException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to obtain keys for decrypting protected media streams. See {@link android.media.MediaDrm}.
|
* Used to obtain keys for decrypting protected media streams. See {@link android.media.MediaDrm}.
|
||||||
@ -137,11 +136,10 @@ public interface ExoMediaDrm<T extends ExoMediaCrypto> {
|
|||||||
/**
|
/**
|
||||||
* @see android.media.MediaCrypto#MediaCrypto(UUID, byte[])
|
* @see android.media.MediaCrypto#MediaCrypto(UUID, byte[])
|
||||||
*
|
*
|
||||||
* @param uuid The UUID of the crypto scheme.
|
|
||||||
* @param initData Opaque initialization data specific to the crypto scheme.
|
* @param initData Opaque initialization data specific to the crypto scheme.
|
||||||
* @return An object extends {@link ExoMediaCrypto}, using opaque crypto scheme specific data.
|
* @return An object extends {@link ExoMediaCrypto}, using opaque crypto scheme specific data.
|
||||||
* @throws MediaCryptoException
|
* @throws MediaCryptoException
|
||||||
*/
|
*/
|
||||||
T createMediaCrypto(UUID uuid, byte[] initData) throws MediaCryptoException;
|
T createMediaCrypto(byte[] initData) throws MediaCryptoException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ import java.util.UUID;
|
|||||||
@TargetApi(18)
|
@TargetApi(18)
|
||||||
public final class FrameworkMediaDrm implements ExoMediaDrm<FrameworkMediaCrypto> {
|
public final class FrameworkMediaDrm implements ExoMediaDrm<FrameworkMediaCrypto> {
|
||||||
|
|
||||||
|
private final UUID uuid;
|
||||||
private final MediaDrm mediaDrm;
|
private final MediaDrm mediaDrm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,10 +60,9 @@ public final class FrameworkMediaDrm implements ExoMediaDrm<FrameworkMediaCrypto
|
|||||||
private FrameworkMediaDrm(UUID uuid) throws UnsupportedSchemeException {
|
private FrameworkMediaDrm(UUID uuid) throws UnsupportedSchemeException {
|
||||||
Assertions.checkNotNull(uuid);
|
Assertions.checkNotNull(uuid);
|
||||||
Assertions.checkArgument(!C.COMMON_PSSH_UUID.equals(uuid), "Use C.CLEARKEY_UUID instead");
|
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.
|
||||||
// ClearKey had to be accessed using the Common PSSH UUID prior to API level 27.
|
uuid = Util.SDK_INT < 27 && C.CLEARKEY_UUID.equals(uuid) ? C.COMMON_PSSH_UUID : uuid;
|
||||||
uuid = C.COMMON_PSSH_UUID;
|
this.uuid = uuid;
|
||||||
}
|
|
||||||
this.mediaDrm = new MediaDrm(uuid);
|
this.mediaDrm = new MediaDrm(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,8 +169,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm<FrameworkMediaCrypto
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FrameworkMediaCrypto createMediaCrypto(UUID uuid, byte[] initData)
|
public FrameworkMediaCrypto createMediaCrypto(byte[] initData) throws MediaCryptoException {
|
||||||
throws MediaCryptoException {
|
|
||||||
// Work around a bug prior to Lollipop where L1 Widevine forced into L3 mode would still
|
// Work around a bug prior to Lollipop where L1 Widevine forced into L3 mode would still
|
||||||
// indicate that it required secure video decoders [Internal ref: b/11428937].
|
// indicate that it required secure video decoders [Internal ref: b/11428937].
|
||||||
boolean forceAllowInsecureDecoderComponents = Util.SDK_INT < 21
|
boolean forceAllowInsecureDecoderComponents = Util.SDK_INT < 21
|
||||||
|
Loading…
x
Reference in New Issue
Block a user