Remove canAcquireSession from DrmSessionManager
It's been replaced by getExoMediaCryptoType(). PiperOrigin-RevId: 323382332
This commit is contained in:
parent
7edc4b1f1e
commit
51e65ff55a
@ -465,38 +465,6 @@ public class DefaultDrmSessionManager implements DrmSessionManager {
|
|||||||
exoMediaDrm = null;
|
exoMediaDrm = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAcquireSession(DrmInitData drmInitData) {
|
|
||||||
if (offlineLicenseKeySetId != null) {
|
|
||||||
// An offline license can be restored so a session can always be acquired.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
List<SchemeData> schemeDatas = getSchemeDatas(drmInitData, uuid, true);
|
|
||||||
if (schemeDatas.isEmpty()) {
|
|
||||||
if (drmInitData.schemeDataCount == 1 && drmInitData.get(0).matches(C.COMMON_PSSH_UUID)) {
|
|
||||||
// Assume scheme specific data will be added before the session is opened.
|
|
||||||
Log.w(
|
|
||||||
TAG, "DrmInitData only contains common PSSH SchemeData. Assuming support for: " + uuid);
|
|
||||||
} else {
|
|
||||||
// No data for this manager's scheme.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String schemeType = drmInitData.schemeType;
|
|
||||||
if (schemeType == null || C.CENC_TYPE_cenc.equals(schemeType)) {
|
|
||||||
// If there is no scheme information, assume patternless AES-CTR.
|
|
||||||
return true;
|
|
||||||
} else if (C.CENC_TYPE_cbc1.equals(schemeType)
|
|
||||||
|| C.CENC_TYPE_cbcs.equals(schemeType)
|
|
||||||
|| C.CENC_TYPE_cens.equals(schemeType)) {
|
|
||||||
// API support for AES-CBC and pattern encryption was added in API 24. However, the
|
|
||||||
// implementation was not stable until API 25.
|
|
||||||
return Util.SDK_INT >= 25;
|
|
||||||
}
|
|
||||||
// Unknown schemes, assume one of them is supported.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public DrmSession acquirePlaceholderSession(Looper playbackLooper, int trackType) {
|
public DrmSession acquirePlaceholderSession(Looper playbackLooper, int trackType) {
|
||||||
@ -593,6 +561,37 @@ public class DefaultDrmSessionManager implements DrmSessionManager {
|
|||||||
|
|
||||||
// Internal methods.
|
// Internal methods.
|
||||||
|
|
||||||
|
private boolean canAcquireSession(DrmInitData drmInitData) {
|
||||||
|
if (offlineLicenseKeySetId != null) {
|
||||||
|
// An offline license can be restored so a session can always be acquired.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
List<SchemeData> schemeDatas = getSchemeDatas(drmInitData, uuid, true);
|
||||||
|
if (schemeDatas.isEmpty()) {
|
||||||
|
if (drmInitData.schemeDataCount == 1 && drmInitData.get(0).matches(C.COMMON_PSSH_UUID)) {
|
||||||
|
// Assume scheme specific data will be added before the session is opened.
|
||||||
|
Log.w(
|
||||||
|
TAG, "DrmInitData only contains common PSSH SchemeData. Assuming support for: " + uuid);
|
||||||
|
} else {
|
||||||
|
// No data for this manager's scheme.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String schemeType = drmInitData.schemeType;
|
||||||
|
if (schemeType == null || C.CENC_TYPE_cenc.equals(schemeType)) {
|
||||||
|
// If there is no scheme information, assume patternless AES-CTR.
|
||||||
|
return true;
|
||||||
|
} else if (C.CENC_TYPE_cbc1.equals(schemeType)
|
||||||
|
|| C.CENC_TYPE_cbcs.equals(schemeType)
|
||||||
|
|| C.CENC_TYPE_cens.equals(schemeType)) {
|
||||||
|
// API support for AES-CBC and pattern encryption was added in API 24. However, the
|
||||||
|
// implementation was not stable until API 25.
|
||||||
|
return Util.SDK_INT >= 25;
|
||||||
|
}
|
||||||
|
// Unknown schemes, assume one of them is supported.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private void initPlaybackLooper(Looper playbackLooper) {
|
private void initPlaybackLooper(Looper playbackLooper) {
|
||||||
if (this.playbackLooper == null) {
|
if (this.playbackLooper == null) {
|
||||||
this.playbackLooper = playbackLooper;
|
this.playbackLooper = playbackLooper;
|
||||||
|
@ -32,11 +32,6 @@ public interface DrmSessionManager {
|
|||||||
DrmSessionManager DUMMY =
|
DrmSessionManager DUMMY =
|
||||||
new DrmSessionManager() {
|
new DrmSessionManager() {
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAcquireSession(DrmInitData drmInitData) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DrmSession acquireSession(
|
public DrmSession acquireSession(
|
||||||
Looper playbackLooper,
|
Looper playbackLooper,
|
||||||
@ -70,16 +65,6 @@ public interface DrmSessionManager {
|
|||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether the manager is capable of acquiring a session for the given
|
|
||||||
* {@link DrmInitData}.
|
|
||||||
*
|
|
||||||
* @param drmInitData DRM initialization data.
|
|
||||||
* @return Whether the manager is capable of acquiring a session for the given
|
|
||||||
* {@link DrmInitData}.
|
|
||||||
*/
|
|
||||||
boolean canAcquireSession(DrmInitData drmInitData);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@link DrmSession} that does not execute key requests, with an incremented reference
|
* Returns a {@link DrmSession} that does not execute key requests, with an incremented reference
|
||||||
* count. When the caller no longer needs to use the instance, it must call {@link
|
* count. When the caller no longer needs to use the instance, it must call {@link
|
||||||
|
Loading…
x
Reference in New Issue
Block a user