Commit ff19262a by olly Committed by Oliver Woodman

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
parent de641380
...@@ -473,7 +473,9 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements ...@@ -473,7 +473,9 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements
} }
private boolean shouldWaitForKeys(boolean bufferEncrypted) throws ExoPlaybackException { private boolean shouldWaitForKeys(boolean bufferEncrypted) throws ExoPlaybackException {
if (decoderDrmSession == null || (!bufferEncrypted && playClearSamplesWithoutKeys)) { if (decoderDrmSession == null
|| (!bufferEncrypted
&& (playClearSamplesWithoutKeys || decoderDrmSession.playClearSamplesWithoutKeys()))) {
return false; return false;
} }
@DrmSession.State int drmSessionState = decoderDrmSession.getState(); @DrmSession.State int drmSessionState = decoderDrmSession.getState();
......
...@@ -356,7 +356,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -356,7 +356,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
@RequiresNonNull("sessionId") @RequiresNonNull("sessionId")
private void doLicense(boolean allowRetry) { private void doLicense(boolean allowRetry) {
if (isPlaceholderSession) { if (isPlaceholderSession) {
state = STATE_OPENED_WITH_KEYS;
return; return;
} }
byte[] sessionId = Util.castNonNull(this.sessionId); byte[] sessionId = Util.castNonNull(this.sessionId);
......
...@@ -77,13 +77,9 @@ public interface DrmSession<T extends ExoMediaCrypto> { ...@@ -77,13 +77,9 @@ public interface DrmSession<T extends ExoMediaCrypto> {
* The session is being opened. * The session is being opened.
*/ */
int STATE_OPENING = 2; int STATE_OPENING = 2;
/** /** The session is open, but does not have keys required for decryption. */
* The session is open, but does not yet have the keys required for decryption.
*/
int STATE_OPENED = 3; int STATE_OPENED = 3;
/** /** The session is open and has keys required for decryption. */
* The session is open and has the keys required for decryption.
*/
int STATE_OPENED_WITH_KEYS = 4; int STATE_OPENED_WITH_KEYS = 4;
/** /**
......
...@@ -1191,7 +1191,9 @@ public abstract class MediaCodecRenderer extends BaseRenderer { ...@@ -1191,7 +1191,9 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
} }
private boolean shouldWaitForKeys(boolean bufferEncrypted) throws ExoPlaybackException { private boolean shouldWaitForKeys(boolean bufferEncrypted) throws ExoPlaybackException {
if (codecDrmSession == null || (!bufferEncrypted && playClearSamplesWithoutKeys)) { if (codecDrmSession == null
|| (!bufferEncrypted
&& (playClearSamplesWithoutKeys || codecDrmSession.playClearSamplesWithoutKeys()))) {
return false; return false;
} }
@DrmSession.State int drmSessionState = codecDrmSession.getState(); @DrmSession.State int drmSessionState = codecDrmSession.getState();
......
...@@ -878,7 +878,9 @@ public abstract class SimpleDecoderVideoRenderer extends BaseRenderer { ...@@ -878,7 +878,9 @@ public abstract class SimpleDecoderVideoRenderer extends BaseRenderer {
} }
private boolean shouldWaitForKeys(boolean bufferEncrypted) throws ExoPlaybackException { private boolean shouldWaitForKeys(boolean bufferEncrypted) throws ExoPlaybackException {
if (decoderDrmSession == null || (!bufferEncrypted && playClearSamplesWithoutKeys)) { if (decoderDrmSession == null
|| (!bufferEncrypted
&& (playClearSamplesWithoutKeys || decoderDrmSession.playClearSamplesWithoutKeys()))) {
return false; return false;
} }
@DrmSession.State int drmSessionState = decoderDrmSession.getState(); @DrmSession.State int drmSessionState = decoderDrmSession.getState();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment