diff --git a/library/core/src/main/java/com/google/android/exoplayer2/drm/ExoMediaDrm.java b/library/core/src/main/java/com/google/android/exoplayer2/drm/ExoMediaDrm.java index 1d0e15e81c..b6ee644842 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/drm/ExoMediaDrm.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/drm/ExoMediaDrm.java @@ -31,6 +31,16 @@ import java.util.UUID; /** * Used to obtain keys for decrypting protected media streams. See {@link android.media.MediaDrm}. + * + *
Access to an instance is managed by reference counting, where {@link #acquire()} increments + * the reference count and {@link #release()} decrements it. When the reference count drops to 0 + * underlying resources are released, and the instance cannot be re-used. + * + *
Each new instance has an initial reference count of 1. Hence application code that creates a
+ * new instance does not normally need to call {@link #acquire()}, and must call {@link #release()}
+ * when the instance is no longer required.
*/
public interface ExoMediaDrm Each call to this method must have a corresponding call to {@link ExoMediaDrm#release()}
- * to ensure correct resource management.
+ * Returns an {@link ExoMediaDrm} instance with an incremented reference count. When the caller
+ * no longer needs to use the instance, it must call {@link ExoMediaDrm#release()} to decrement
+ * the reference count.
*/
ExoMediaDrm This provider should be used to manually handle {@link ExoMediaDrm} resources.
+ * Note that when using this provider the app will have instantiated the {@link ExoMediaDrm}
+ * instance, and remains responsible for calling {@link ExoMediaDrm#release()} on the instance
+ * when it's no longer being used.
*/
final class AppManagedProvider A new instance will have an initial reference count of 1, and therefore it is not normally
+ * necessary for application code to call this method.
*/
void acquire();
/**
- * Releases ownership of this instance. If a call to this method causes this instance to have no
- * acquired ownerships, releases the underlying resources.
- *
- * Callers of this method must not make any further use of this instance.
- *
- * @see MediaDrm#release()
+ * Decrements the reference count. If the reference count drops to 0 underlying resources are
+ * released, and the instance cannot be re-used.
*/
void release();
diff --git a/library/core/src/main/java/com/google/android/exoplayer2/drm/FrameworkMediaDrm.java b/library/core/src/main/java/com/google/android/exoplayer2/drm/FrameworkMediaDrm.java
index d040552638..8ac92b093c 100644
--- a/library/core/src/main/java/com/google/android/exoplayer2/drm/FrameworkMediaDrm.java
+++ b/library/core/src/main/java/com/google/android/exoplayer2/drm/FrameworkMediaDrm.java
@@ -55,8 +55,6 @@ public final class FrameworkMediaDrm implements ExoMediaDrm