Skip to content

Commit

Permalink
Add ExoMediaDrm.Provider
Browse files Browse the repository at this point in the history
Allows shared ownership of ExoMediaDrms. Shared ownership will
allow users to pre-create ExoMediaDrms in their apps, as opposed
to having the DrmSessionManager create the ExoMediaDrm.

Issue:#4721
PiperOrigin-RevId: 269305850
  • Loading branch information
AquilesCanta authored and ojw28 committed Sep 16, 2019
1 parent c5ceefd commit 9face09
Showing 2 changed files with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -33,9 +33,20 @@
*/
public interface ExoMediaDrm<T extends ExoMediaCrypto> {

/**
* @see MediaDrm#EVENT_KEY_REQUIRED
*/
/** {@link ExoMediaDrm} instances provider. */
interface Provider<T extends ExoMediaCrypto> {

/**
* Returns an {@link ExoMediaDrm} instance with acquired ownership for the DRM scheme identified
* by the given UUID.
*
* <p>Each call to this method must have a corresponding call to {@link ExoMediaDrm#release()}
* to ensure correct resource management.
*/
ExoMediaDrm<T> acquireExoMediaDrm(UUID uuid);
}

/** @see MediaDrm#EVENT_KEY_REQUIRED */
@SuppressWarnings("InlinedApi")
int EVENT_KEY_REQUIRED = MediaDrm.EVENT_KEY_REQUIRED;
/**
@@ -235,6 +246,16 @@ byte[] provideKeyResponse(byte[] scope, byte[] response)
Map<String, String> queryKeyStatus(byte[] sessionId);

/**
* Acquires ownership over this instance, which must be released by calling {@link #release()}.
*/
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.
*
* <p>Callers of this method must not make any further use of this instance.
*
* @see MediaDrm#release()
*/
void release();
Original file line number Diff line number Diff line change
@@ -185,6 +185,11 @@ public Map<String, String> queryKeyStatus(byte[] sessionId) {
return mediaDrm.queryKeyStatus(sessionId);
}

@Override
public void acquire() {
// TODO: Implement reference counting.
}

@Override
public void release() {
mediaDrm.release();

0 comments on commit 9face09

Please sign in to comment.