提交 f44e30c7 编写于 作者: O olly 提交者: Oliver Woodman

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
上级 3e762270
......@@ -226,7 +226,7 @@ import java.util.UUID;
try {
sessionId = mediaDrm.openSession();
mediaCrypto = mediaDrm.createMediaCrypto(uuid, sessionId);
mediaCrypto = mediaDrm.createMediaCrypto(sessionId);
state = STATE_OPENED;
return true;
} catch (NotProvisionedException e) {
......
......@@ -60,7 +60,7 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
if (cloneSchemeDatas) {
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.
Arrays.sort(schemeDatas, this);
// Check for no duplicates.
......
......@@ -22,7 +22,6 @@ import android.media.NotProvisionedException;
import android.media.ResourceBusyException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
* 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[])
*
* @param uuid The UUID of 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.
* @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)
public final class FrameworkMediaDrm implements ExoMediaDrm<FrameworkMediaCrypto> {
private final UUID uuid;
private final MediaDrm mediaDrm;
/**
......@@ -59,10 +60,9 @@ public final class FrameworkMediaDrm implements ExoMediaDrm<FrameworkMediaCrypto
private FrameworkMediaDrm(UUID uuid) throws UnsupportedSchemeException {
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;
}
// 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;
this.uuid = uuid;
this.mediaDrm = new MediaDrm(uuid);
}
......@@ -169,8 +169,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm<FrameworkMediaCrypto
}
@Override
public FrameworkMediaCrypto createMediaCrypto(UUID uuid, byte[] initData)
throws MediaCryptoException {
public FrameworkMediaCrypto createMediaCrypto(byte[] initData) throws MediaCryptoException {
// 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].
boolean forceAllowInsecureDecoderComponents = Util.SDK_INT < 21
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册