mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Fix canAcquireSession for ClearKey
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=165159376
This commit is contained in:
parent
1829d71d29
commit
870c8ae4df
1 changed files with 17 additions and 6 deletions
|
|
@ -311,7 +311,7 @@ public class DefaultDrmSessionManager<T extends ExoMediaCrypto> implements DrmSe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcquireSession(@NonNull DrmInitData drmInitData) {
|
public boolean canAcquireSession(@NonNull DrmInitData drmInitData) {
|
||||||
SchemeData schemeData = drmInitData.get(uuid);
|
SchemeData schemeData = getSchemeData(drmInitData);
|
||||||
if (schemeData == null) {
|
if (schemeData == null) {
|
||||||
// No data for this manager's scheme.
|
// No data for this manager's scheme.
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -347,11 +347,7 @@ public class DefaultDrmSessionManager<T extends ExoMediaCrypto> implements DrmSe
|
||||||
postRequestHandler = new PostRequestHandler(requestHandlerThread.getLooper());
|
postRequestHandler = new PostRequestHandler(requestHandlerThread.getLooper());
|
||||||
|
|
||||||
if (offlineLicenseKeySetId == null) {
|
if (offlineLicenseKeySetId == null) {
|
||||||
SchemeData schemeData = drmInitData.get(uuid);
|
SchemeData schemeData = getSchemeData(drmInitData);
|
||||||
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) {
|
if (schemeData == null) {
|
||||||
onError(new IllegalStateException("Media does not support uuid: " + uuid));
|
onError(new IllegalStateException("Media does not support uuid: " + uuid));
|
||||||
return this;
|
return this;
|
||||||
|
|
@ -627,6 +623,21 @@ public class DefaultDrmSessionManager<T extends ExoMediaCrypto> implements DrmSe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts {@link SchemeData} suitable for this manager.
|
||||||
|
*
|
||||||
|
* @param drmInitData The {@link DrmInitData} from which to extract the {@link SchemeData}.
|
||||||
|
* @return The extracted {@link SchemeData}, or null if no suitable data is present.
|
||||||
|
*/
|
||||||
|
private SchemeData getSchemeData(DrmInitData drmInitData) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
return schemeData;
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("HandlerLeak")
|
@SuppressLint("HandlerLeak")
|
||||||
private class MediaDrmHandler extends Handler {
|
private class MediaDrmHandler extends Handler {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue