Skip to content

Commit

Permalink
Remove mediaDrm methods from DefaultDrmSessionManager
Browse files Browse the repository at this point in the history
DrmSessionManagers may now be in released state, in which case they
may release their MediaDrm. In that case, it would be invalid to
forward method calls to the underlying MediaDrms. Users should
instead call these methods directly on the MediaDrm.

Issue:#4721
PiperOrigin-RevId: 270963393
  • Loading branch information
AquilesCanta authored and ojw28 committed Oct 2, 2019
1 parent 4df2262 commit fa80396
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,54 +233,6 @@ public final void removeListener(DefaultDrmSessionEventListener eventListener) {
eventDispatcher.removeListener(eventListener);
}

/**
* Provides access to {@link ExoMediaDrm#getPropertyString(String)}.
*
* <p>This method may be called when the manager is in any state.
*
* @param key The key to request.
* @return The retrieved property.
*/
public final String getPropertyString(String key) {
return mediaDrm.getPropertyString(key);
}

/**
* Provides access to {@link ExoMediaDrm#setPropertyString(String, String)}.
*
* <p>This method may be called when the manager is in any state.
*
* @param key The property to write.
* @param value The value to write.
*/
public final void setPropertyString(String key, String value) {
mediaDrm.setPropertyString(key, value);
}

/**
* Provides access to {@link ExoMediaDrm#getPropertyByteArray(String)}.
*
* <p>This method may be called when the manager is in any state.
*
* @param key The key to request.
* @return The retrieved property.
*/
public final byte[] getPropertyByteArray(String key) {
return mediaDrm.getPropertyByteArray(key);
}

/**
* Provides access to {@link ExoMediaDrm#setPropertyByteArray(String, byte[])}.
*
* <p>This method may be called when the manager is in any state.
*
* @param key The property to write.
* @param value The value to write.
*/
public final void setPropertyByteArray(String key, byte[] value) {
mediaDrm.setPropertyByteArray(key, value);
}

/**
* Sets the mode, which determines the role of sessions acquired from the instance. This must be
* called before {@link #acquireSession(Looper, DrmInitData)} or {@link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,34 +152,6 @@ public void onDrmKeysRemoved() {
drmSessionManager.addListener(new Handler(handlerThread.getLooper()), eventListener);
}

/**
* @see DefaultDrmSessionManager#getPropertyByteArray
*/
public synchronized byte[] getPropertyByteArray(String key) {
return drmSessionManager.getPropertyByteArray(key);
}

/**
* @see DefaultDrmSessionManager#setPropertyByteArray
*/
public synchronized void setPropertyByteArray(String key, byte[] value) {
drmSessionManager.setPropertyByteArray(key, value);
}

/**
* @see DefaultDrmSessionManager#getPropertyString
*/
public synchronized String getPropertyString(String key) {
return drmSessionManager.getPropertyString(key);
}

/**
* @see DefaultDrmSessionManager#setPropertyString
*/
public synchronized void setPropertyString(String key, String value) {
drmSessionManager.setPropertyString(key, value);
}

/**
* Downloads an offline license.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,17 +266,17 @@ protected DrmSessionManager<FrameworkMediaCrypto> buildDrmSessionManager(
try {
MediaDrmCallback drmCallback = new HttpMediaDrmCallback(widevineLicenseUrl,
new DefaultHttpDataSourceFactory(userAgent));
FrameworkMediaDrm frameworkMediaDrm = FrameworkMediaDrm.newInstance(WIDEVINE_UUID);
DefaultDrmSessionManager<FrameworkMediaCrypto> drmSessionManager =
new DefaultDrmSessionManager<>(
C.WIDEVINE_UUID,
FrameworkMediaDrm.newInstance(C.WIDEVINE_UUID),
frameworkMediaDrm,
drmCallback,
/* optionalKeyRequestParameters= */ null,
/* multiSession= */ false,
DefaultDrmSessionManager.INITIAL_DRM_REQUEST_RETRY_COUNT);
if (!useL1Widevine) {
drmSessionManager.setPropertyString(
SECURITY_LEVEL_PROPERTY, WIDEVINE_SECURITY_LEVEL_3);
frameworkMediaDrm.setPropertyString(SECURITY_LEVEL_PROPERTY, WIDEVINE_SECURITY_LEVEL_3);
}
if (offlineLicenseKeySetId != null) {
drmSessionManager.setMode(DefaultDrmSessionManager.MODE_PLAYBACK,
Expand Down

0 comments on commit fa80396

Please sign in to comment.