mirror of
https://github.com/samsonjs/media.git
synced 2026-04-08 11:45:51 +00:00
Simplify DefaultDrmSession event handling
- Handling EVENT_PROVISION_REQUIRED is unnecessary because we handle it via NotProvisionedException, which was thrown on all API levels. - Handling EVENT_KEY_EXPIRED during playback is unnecessary. All it does is cause an error to be thrown, but an error will be thrown anyway out of the MediaCodec when it tries to use the expired keys. It's currently a race condition where the error gets thrown from, where-as having it always be thrown from one place is preferable. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=219172021
This commit is contained in:
parent
7eeeb40d24
commit
053a7bc0b9
1 changed files with 2 additions and 22 deletions
|
|
@ -207,18 +207,11 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||
return Arrays.equals(this.sessionId, sessionId);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void onMediaDrmEvent(int what) {
|
||||
switch (what) {
|
||||
case ExoMediaDrm.EVENT_PROVISION_REQUIRED:
|
||||
onProvisionRequired();
|
||||
break;
|
||||
case ExoMediaDrm.EVENT_KEY_REQUIRED:
|
||||
onKeysRequired();
|
||||
break;
|
||||
case ExoMediaDrm.EVENT_KEY_EXPIRED:
|
||||
onKeysExpired();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -434,23 +427,10 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||
}
|
||||
}
|
||||
|
||||
private void onProvisionRequired() {
|
||||
if (mode == DefaultDrmSessionManager.MODE_PLAYBACK && isOpen()) {
|
||||
state = STATE_OPENED;
|
||||
provisioningManager.provisionRequired(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void onKeysRequired() {
|
||||
if (mode == DefaultDrmSessionManager.MODE_PLAYBACK && isOpen()) {
|
||||
doLicense(/* allowRetry= */ false);
|
||||
}
|
||||
}
|
||||
|
||||
private void onKeysExpired() {
|
||||
if (mode == DefaultDrmSessionManager.MODE_PLAYBACK && state == STATE_OPENED_WITH_KEYS) {
|
||||
state = STATE_OPENED;
|
||||
onError(new KeysExpiredException());
|
||||
Util.castNonNull(sessionId);
|
||||
doLicense(/* allowRetry= */ false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue