Commit cc8b774b by aquilescanta Committed by Oliver Woodman

Remove DefaultDrmSessionManager factory methods that enforce MediaDrm leaks

Inline invocations of these methods, which still leaks the MediaDrms.
However, it will be fixed once the DefaultDrmSessionManager API is finalized
and ExoMediaDrm.Providers are introduced.

Issue:#4721
PiperOrigin-RevId: 270681467
parent 19836678
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
`httpRequestHeaders`. `httpRequestHeaders`.
* DASH: Support negative @r values in segment timelines * DASH: Support negative @r values in segment timelines
([#1787](https://github.com/google/ExoPlayer/issues/1787)). ([#1787](https://github.com/google/ExoPlayer/issues/1787)).
* Remove `DefaultDrmSessionManager` factory methods that leak `ExoMediaDrm`
instances ([#4721](https://github.com/google/ExoPlayer/issues/4721)).
* Add `allowedCapturePolicy` field to `AudioAttributes` wrapper to allow to * Add `allowedCapturePolicy` field to `AudioAttributes` wrapper to allow to
opt-out of audio recording. opt-out of audio recording.
* Add `DataSpec.httpRequestHeaders` to set HTTP request headers when connecting * Add `DataSpec.httpRequestHeaders` to set HTTP request headers when connecting
......
...@@ -20,7 +20,6 @@ import android.annotation.TargetApi; ...@@ -20,7 +20,6 @@ import android.annotation.TargetApi;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.Message; import android.os.Message;
import android.text.TextUtils;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
...@@ -107,65 +106,6 @@ public class DefaultDrmSessionManager<T extends ExoMediaCrypto> ...@@ -107,65 +106,6 @@ public class DefaultDrmSessionManager<T extends ExoMediaCrypto>
/* package */ volatile @Nullable MediaDrmHandler mediaDrmHandler; /* package */ volatile @Nullable MediaDrmHandler mediaDrmHandler;
/** /**
* Instantiates a new instance using the Widevine scheme.
*
* @param callback Performs key and provisioning requests.
* @param optionalKeyRequestParameters An optional map of parameters to pass as the last argument
* to {@link ExoMediaDrm#getKeyRequest(byte[], List, int, HashMap)}. May be null.
* @throws UnsupportedDrmException If the specified DRM scheme is not supported.
*/
public static DefaultDrmSessionManager<FrameworkMediaCrypto> newWidevineInstance(
MediaDrmCallback callback, @Nullable HashMap<String, String> optionalKeyRequestParameters)
throws UnsupportedDrmException {
return newFrameworkInstance(C.WIDEVINE_UUID, callback, optionalKeyRequestParameters);
}
/**
* Instantiates a new instance using the PlayReady scheme.
*
* <p>Note that PlayReady is unsupported by most Android devices, with the exception of Android TV
* devices, which do provide support.
*
* @param callback Performs key and provisioning requests.
* @param customData Optional custom data to include in requests generated by the instance.
* @throws UnsupportedDrmException If the specified DRM scheme is not supported.
*/
public static DefaultDrmSessionManager<FrameworkMediaCrypto> newPlayReadyInstance(
MediaDrmCallback callback, @Nullable String customData) throws UnsupportedDrmException {
HashMap<String, String> optionalKeyRequestParameters;
if (!TextUtils.isEmpty(customData)) {
optionalKeyRequestParameters = new HashMap<>();
optionalKeyRequestParameters.put(PLAYREADY_CUSTOM_DATA_KEY, customData);
} else {
optionalKeyRequestParameters = null;
}
return newFrameworkInstance(C.PLAYREADY_UUID, callback, optionalKeyRequestParameters);
}
/**
* Instantiates a new instance.
*
* @param uuid The UUID of the drm scheme.
* @param callback Performs key and provisioning requests.
* @param optionalKeyRequestParameters An optional map of parameters to pass as the last argument
* to {@link ExoMediaDrm#getKeyRequest(byte[], List, int, HashMap)}. May be null.
* @throws UnsupportedDrmException If the specified DRM scheme is not supported.
*/
public static DefaultDrmSessionManager<FrameworkMediaCrypto> newFrameworkInstance(
UUID uuid,
MediaDrmCallback callback,
@Nullable HashMap<String, String> optionalKeyRequestParameters)
throws UnsupportedDrmException {
return new DefaultDrmSessionManager<>(
uuid,
FrameworkMediaDrm.newInstance(uuid),
callback,
optionalKeyRequestParameters,
/* multiSession= */ false,
INITIAL_DRM_REQUEST_RETRY_COUNT);
}
/**
* @param uuid The UUID of the drm scheme. * @param uuid The UUID of the drm scheme.
* @param mediaDrm An underlying {@link ExoMediaDrm} for use by the manager. * @param mediaDrm An underlying {@link ExoMediaDrm} for use by the manager.
* @param callback Performs key and provisioning requests. * @param callback Performs key and provisioning requests.
......
...@@ -30,6 +30,7 @@ import com.google.android.exoplayer2.decoder.DecoderCounters; ...@@ -30,6 +30,7 @@ import com.google.android.exoplayer2.decoder.DecoderCounters;
import com.google.android.exoplayer2.drm.DefaultDrmSessionManager; import com.google.android.exoplayer2.drm.DefaultDrmSessionManager;
import com.google.android.exoplayer2.drm.DrmSessionManager; import com.google.android.exoplayer2.drm.DrmSessionManager;
import com.google.android.exoplayer2.drm.FrameworkMediaCrypto; import com.google.android.exoplayer2.drm.FrameworkMediaCrypto;
import com.google.android.exoplayer2.drm.FrameworkMediaDrm;
import com.google.android.exoplayer2.drm.HttpMediaDrmCallback; import com.google.android.exoplayer2.drm.HttpMediaDrmCallback;
import com.google.android.exoplayer2.drm.MediaDrmCallback; import com.google.android.exoplayer2.drm.MediaDrmCallback;
import com.google.android.exoplayer2.drm.UnsupportedDrmException; import com.google.android.exoplayer2.drm.UnsupportedDrmException;
...@@ -266,7 +267,13 @@ public final class DashTestRunner { ...@@ -266,7 +267,13 @@ public final class DashTestRunner {
MediaDrmCallback drmCallback = new HttpMediaDrmCallback(widevineLicenseUrl, MediaDrmCallback drmCallback = new HttpMediaDrmCallback(widevineLicenseUrl,
new DefaultHttpDataSourceFactory(userAgent)); new DefaultHttpDataSourceFactory(userAgent));
DefaultDrmSessionManager<FrameworkMediaCrypto> drmSessionManager = DefaultDrmSessionManager<FrameworkMediaCrypto> drmSessionManager =
DefaultDrmSessionManager.newWidevineInstance(drmCallback, null); new DefaultDrmSessionManager<>(
C.WIDEVINE_UUID,
FrameworkMediaDrm.newInstance(C.WIDEVINE_UUID),
drmCallback,
/* optionalKeyRequestParameters= */ null,
/* multiSession= */ false,
DefaultDrmSessionManager.INITIAL_DRM_REQUEST_RETRY_COUNT);
if (!useL1Widevine) { if (!useL1Widevine) {
drmSessionManager.setPropertyString( drmSessionManager.setPropertyString(
SECURITY_LEVEL_PROPERTY, WIDEVINE_SECURITY_LEVEL_3); SECURITY_LEVEL_PROPERTY, WIDEVINE_SECURITY_LEVEL_3);
......
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