Commit 2c7473dc by olly Committed by Oliver Woodman

Clean up logic for determining whether DRM reconfig needs codec re-init

1. Move logic to decide to re-initialize the codec rather than using
   MediaCodec.setMediaDrmSession if (a) PlayReady is in use, and (b)
   the new session is still provisioning. This would previously have
   happened asynchronously after an input format change, after the
   decoder has subsequently been flushed. After this change the logic
   executes synchronously when the input format changes. This helps
   with the ref'd bug, since we want to propagate reasons for codec
   re-initialization through inputFormatChanged events.
2. Whilst moving the logic for re-initialization if PlayReady is
   being used, I fixed a bug that would occur when switching from
   [PlayReady --> non-PlayReady]. Re-use doesn't work in this case.
   The old logic only checked for the [Something --> PlayReady] case.
3. Remove pointless codec flush if updating the DRM session having
   not queued anything to the codec.

PiperOrigin-RevId: 340299790
parent 9d3875a8
......@@ -34,6 +34,9 @@
* Matroska: Add support for 32-bit floating point PCM, and 8-bit and
16-bit big endian integer PCM
([#8142](https://github.com/google/ExoPlayer/issues/8142)).
* DRM:
* Fix playback failure when switching from PlayReady protected content to
Widevine or Clearkey protected content in a playlist.
* IMA extension:
* Upgrade IMA SDK dependency to 3.21.0, and release the `AdsLoader`
([#7344](https://github.com/google/ExoPlayer/issues/7344)).
......
......@@ -257,6 +257,11 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
}
@Override
public final UUID getSchemeUuid() {
return uuid;
}
@Override
public final @Nullable ExoMediaCrypto getMediaCrypto() {
return mediaCrypto;
}
......
......@@ -23,6 +23,7 @@ import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Map;
import java.util.UUID;
/** A DRM session. */
public interface DrmSession {
......@@ -101,6 +102,9 @@ public interface DrmSession {
@Nullable
DrmSessionException getError();
/** Returns the DRM scheme UUID for this session. */
UUID getSchemeUuid();
/**
* Returns an {@link ExoMediaCrypto} for the open session, or null if called before the session
* has been opened or after it's been released.
......
......@@ -16,8 +16,10 @@
package com.google.android.exoplayer2.drm;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.util.Assertions;
import java.util.Map;
import java.util.UUID;
/** A {@link DrmSession} that's in a terminal error state. */
public final class ErrorStateDrmSession implements DrmSession {
......@@ -45,6 +47,11 @@ public final class ErrorStateDrmSession implements DrmSession {
}
@Override
public final UUID getSchemeUuid() {
return C.UUID_NIL;
}
@Override
@Nullable
public ExoMediaCrypto getMediaCrypto() {
return null;
......
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