| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.media; | 5 package org.chromium.media; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; |
| 7 import android.annotation.TargetApi; | 8 import android.annotation.TargetApi; |
| 8 import android.media.MediaCrypto; | 9 import android.media.MediaCrypto; |
| 9 import android.media.MediaDrm; | 10 import android.media.MediaDrm; |
| 10 import android.os.Build; | 11 import android.os.Build; |
| 11 | 12 |
| 12 import org.chromium.base.Log; | 13 import org.chromium.base.Log; |
| 13 import org.chromium.base.annotations.CalledByNative; | 14 import org.chromium.base.annotations.CalledByNative; |
| 14 import org.chromium.base.annotations.JNINamespace; | 15 import org.chromium.base.annotations.JNINamespace; |
| 15 import org.chromium.base.annotations.MainDex; | 16 import org.chromium.base.annotations.MainDex; |
| 16 | 17 |
| 17 import java.nio.ByteBuffer; | 18 import java.nio.ByteBuffer; |
| 18 import java.util.ArrayDeque; | 19 import java.util.ArrayDeque; |
| 19 import java.util.ArrayList; | 20 import java.util.ArrayList; |
| 20 import java.util.Arrays; | 21 import java.util.Arrays; |
| 21 import java.util.HashMap; | 22 import java.util.HashMap; |
| 22 import java.util.List; | 23 import java.util.List; |
| 23 import java.util.UUID; | 24 import java.util.UUID; |
| 24 | 25 |
| 25 /** | 26 /** |
| 26 * A wrapper of the android MediaDrm class. Each MediaDrmBridge manages multiple | 27 * A wrapper of the android MediaDrm class. Each MediaDrmBridge manages multiple |
| 27 * sessions for a single MediaSourcePlayer. | 28 * sessions for a single MediaSourcePlayer. |
| 28 */ | 29 */ |
| 29 @JNINamespace("media") | 30 @JNINamespace("media") |
| 31 @SuppressLint("WrongConstant") |
| 30 @TargetApi(Build.VERSION_CODES.KITKAT) | 32 @TargetApi(Build.VERSION_CODES.KITKAT) |
| 31 public class MediaDrmBridge { | 33 public class MediaDrmBridge { |
| 32 // Implementation Notes: | 34 // Implementation Notes: |
| 33 // - A media crypto session (mMediaCryptoSession) is opened after MediaDrm | 35 // - A media crypto session (mMediaCryptoSession) is opened after MediaDrm |
| 34 // is created. This session will NOT be added to mSessionIds and will only | 36 // is created. This session will NOT be added to mSessionIds and will only |
| 35 // be used to create the MediaCrypto object. | 37 // be used to create the MediaCrypto object. |
| 36 // - Each createSession() call creates a new session. All created sessions | 38 // - Each createSession() call creates a new session. All created sessions |
| 37 // are managed in mSessionIds. | 39 // are managed in mSessionIds. |
| 38 // - Whenever NotProvisionedException is thrown, we will clean up the | 40 // - Whenever NotProvisionedException is thrown, we will clean up the |
| 39 // current state and start the provisioning process. | 41 // current state and start the provisioning process. |
| (...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 private native void nativeOnSessionKeysChange(long nativeMediaDrmBridge, byt
e[] sessionId, | 1031 private native void nativeOnSessionKeysChange(long nativeMediaDrmBridge, byt
e[] sessionId, |
| 1030 Object[] keysInfo, boolean hasAdditionalUsableKey); | 1032 Object[] keysInfo, boolean hasAdditionalUsableKey); |
| 1031 private native void nativeOnSessionExpirationUpdate( | 1033 private native void nativeOnSessionExpirationUpdate( |
| 1032 long nativeMediaDrmBridge, byte[] sessionId, long expirationTime); | 1034 long nativeMediaDrmBridge, byte[] sessionId, long expirationTime); |
| 1033 private native void nativeOnLegacySessionError( | 1035 private native void nativeOnLegacySessionError( |
| 1034 long nativeMediaDrmBridge, byte[] sessionId, String errorMessage); | 1036 long nativeMediaDrmBridge, byte[] sessionId, String errorMessage); |
| 1035 | 1037 |
| 1036 private native void nativeOnResetDeviceCredentialsCompleted( | 1038 private native void nativeOnResetDeviceCredentialsCompleted( |
| 1037 long nativeMediaDrmBridge, boolean success); | 1039 long nativeMediaDrmBridge, boolean success); |
| 1038 } | 1040 } |
| OLD | NEW |