Make placeholder sessions report their true state

Note that the renderer changes will all disappear when we remove
legacy injection of DrmSessionManager into renderers.

PiperOrigin-RevId: 281952601
This commit is contained in:
olly 2019-11-22 13:57:43 +00:00 committed by Oliver Woodman
parent de641380df
commit ff19262a5e
5 changed files with 11 additions and 10 deletions

View file

@ -473,7 +473,9 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements
}
private boolean shouldWaitForKeys(boolean bufferEncrypted) throws ExoPlaybackException {
if (decoderDrmSession == null || (!bufferEncrypted && playClearSamplesWithoutKeys)) {
if (decoderDrmSession == null
|| (!bufferEncrypted
&& (playClearSamplesWithoutKeys || decoderDrmSession.playClearSamplesWithoutKeys()))) {
return false;
}
@DrmSession.State int drmSessionState = decoderDrmSession.getState();

View file

@ -356,7 +356,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
@RequiresNonNull("sessionId")
private void doLicense(boolean allowRetry) {
if (isPlaceholderSession) {
state = STATE_OPENED_WITH_KEYS;
return;
}
byte[] sessionId = Util.castNonNull(this.sessionId);

View file

@ -77,13 +77,9 @@ public interface DrmSession<T extends ExoMediaCrypto> {
* The session is being opened.
*/
int STATE_OPENING = 2;
/**
* The session is open, but does not yet have the keys required for decryption.
*/
/** The session is open, but does not have keys required for decryption. */
int STATE_OPENED = 3;
/**
* The session is open and has the keys required for decryption.
*/
/** The session is open and has keys required for decryption. */
int STATE_OPENED_WITH_KEYS = 4;
/**

View file

@ -1191,7 +1191,9 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
}
private boolean shouldWaitForKeys(boolean bufferEncrypted) throws ExoPlaybackException {
if (codecDrmSession == null || (!bufferEncrypted && playClearSamplesWithoutKeys)) {
if (codecDrmSession == null
|| (!bufferEncrypted
&& (playClearSamplesWithoutKeys || codecDrmSession.playClearSamplesWithoutKeys()))) {
return false;
}
@DrmSession.State int drmSessionState = codecDrmSession.getState();

View file

@ -878,7 +878,9 @@ public abstract class SimpleDecoderVideoRenderer extends BaseRenderer {
}
private boolean shouldWaitForKeys(boolean bufferEncrypted) throws ExoPlaybackException {
if (decoderDrmSession == null || (!bufferEncrypted && playClearSamplesWithoutKeys)) {
if (decoderDrmSession == null
|| (!bufferEncrypted
&& (playClearSamplesWithoutKeys || decoderDrmSession.playClearSamplesWithoutKeys()))) {
return false;
}
@DrmSession.State int drmSessionState = decoderDrmSession.getState();