Clarify DRM error deferral comments

- I don't think the session recovering later would work, because
  the codec will be configured not to use it.
- I'm not sure session recovery makes sense in general, and our
  implementations do not do this. Document it as a terminal state
  for now.

PiperOrigin-RevId: 340204194
This commit is contained in:
olly 2020-11-02 12:00:37 +00:00 committed by Oliver Woodman
parent be1fd23666
commit 1d12d03283
4 changed files with 8 additions and 9 deletions

View File

@ -603,8 +603,8 @@ public abstract class DecoderAudioRenderer<
if (mediaCrypto == null) { if (mediaCrypto == null) {
DrmSessionException drmError = decoderDrmSession.getError(); DrmSessionException drmError = decoderDrmSession.getError();
if (drmError != null) { if (drmError != null) {
// Continue for now. We may be able to avoid failure if the session recovers, or if a new // Continue for now. We may be able to avoid failure if a new input format causes the
// input format causes the session to be replaced before it's used. // session to be replaced without it having been used.
} else { } else {
// The drm session isn't open yet. // The drm session isn't open yet.
return; return;

View File

@ -66,12 +66,11 @@ public interface DrmSession {
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@IntDef({STATE_RELEASED, STATE_ERROR, STATE_OPENING, STATE_OPENED, STATE_OPENED_WITH_KEYS}) @IntDef({STATE_RELEASED, STATE_ERROR, STATE_OPENING, STATE_OPENED, STATE_OPENED_WITH_KEYS})
@interface State {} @interface State {}
/** /** The session has been released. This is a terminal state. */
* The session has been released.
*/
int STATE_RELEASED = 0; int STATE_RELEASED = 0;
/** /**
* The session has encountered an error. {@link #getError()} can be used to retrieve the cause. * The session has encountered an error. {@link #getError()} can be used to retrieve the cause.
* This is a terminal state.
*/ */
int STATE_ERROR = 1; int STATE_ERROR = 1;
/** /**

View File

@ -499,8 +499,8 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
if (sessionMediaCrypto == null) { if (sessionMediaCrypto == null) {
@Nullable DrmSessionException drmError = codecDrmSession.getError(); @Nullable DrmSessionException drmError = codecDrmSession.getError();
if (drmError != null) { if (drmError != null) {
// Continue for now. We may be able to avoid failure if the session recovers, or if a // Continue for now. We may be able to avoid failure if a new input format causes the
// new input format causes the session to be replaced before it's used. // session to be replaced without it having been used.
} else { } else {
// The drm session isn't open yet. // The drm session isn't open yet.
return; return;

View File

@ -661,8 +661,8 @@ public abstract class DecoderVideoRenderer extends BaseRenderer {
if (mediaCrypto == null) { if (mediaCrypto == null) {
DrmSessionException drmError = decoderDrmSession.getError(); DrmSessionException drmError = decoderDrmSession.getError();
if (drmError != null) { if (drmError != null) {
// Continue for now. We may be able to avoid failure if the session recovers, or if a new // Continue for now. We may be able to avoid failure if a new input format causes the
// input format causes the session to be replaced before it's used. // session to be replaced without it having been used.
} else { } else {
// The drm session isn't open yet. // The drm session isn't open yet.
return; return;