mirror of
https://github.com/samsonjs/media.git
synced 2026-04-09 11:55:46 +00:00
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
This commit is contained in:
parent
1983667845
commit
cc8b774b41
3 changed files with 10 additions and 61 deletions
|
|
@ -7,6 +7,8 @@
|
|||
`httpRequestHeaders`.
|
||||
* DASH: Support negative @r values in segment timelines
|
||||
([#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
|
||||
opt-out of audio recording.
|
||||
* Add `DataSpec.httpRequestHeaders` to set HTTP request headers when connecting
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import android.annotation.TargetApi;
|
|||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.exoplayer2.C;
|
||||
|
|
@ -106,65 +105,6 @@ public class DefaultDrmSessionManager<T extends ExoMediaCrypto>
|
|||
|
||||
/* 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 mediaDrm An underlying {@link ExoMediaDrm} for use by the manager.
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import com.google.android.exoplayer2.decoder.DecoderCounters;
|
|||
import com.google.android.exoplayer2.drm.DefaultDrmSessionManager;
|
||||
import com.google.android.exoplayer2.drm.DrmSessionManager;
|
||||
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.MediaDrmCallback;
|
||||
import com.google.android.exoplayer2.drm.UnsupportedDrmException;
|
||||
|
|
@ -266,7 +267,13 @@ public final class DashTestRunner {
|
|||
MediaDrmCallback drmCallback = new HttpMediaDrmCallback(widevineLicenseUrl,
|
||||
new DefaultHttpDataSourceFactory(userAgent));
|
||||
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) {
|
||||
drmSessionManager.setPropertyString(
|
||||
SECURITY_LEVEL_PROPERTY, WIDEVINE_SECURITY_LEVEL_3);
|
||||
|
|
|
|||
Loading…
Reference in a new issue