Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: media/base/android/java/src/org/chromium/media/MediaDrmBridge.java

Issue 1341883003: Prepare MediaDrmBridge to work with MediaCodecPlayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bug526755
Patch Set: Split original CL into two, this is first part Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.TargetApi; 7 import android.annotation.TargetApi;
8 import android.media.MediaCrypto; 8 import android.media.MediaCrypto;
9 import android.media.MediaDrm; 9 import android.media.MediaDrm;
10 import android.os.AsyncTask; 10 import android.os.AsyncTask;
11 import android.os.Build; 11 import android.os.Build;
12 import android.os.Handler; 12 import android.os.Handler;
13 import android.os.Looper;
13 14
14 import org.chromium.base.Log; 15 import org.chromium.base.Log;
15 import org.chromium.base.annotations.CalledByNative; 16 import org.chromium.base.annotations.CalledByNative;
16 import org.chromium.base.annotations.JNINamespace; 17 import org.chromium.base.annotations.JNINamespace;
17 18
18 import java.io.BufferedInputStream; 19 import java.io.BufferedInputStream;
19 import java.io.ByteArrayOutputStream; 20 import java.io.ByteArrayOutputStream;
20 import java.io.IOException; 21 import java.io.IOException;
21 import java.net.HttpURLConnection; 22 import java.net.HttpURLConnection;
22 import java.net.MalformedURLException; 23 import java.net.MalformedURLException;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 203
203 @TargetApi(Build.VERSION_CODES.M) 204 @TargetApi(Build.VERSION_CODES.M)
204 private MediaDrmBridge(UUID schemeUUID, long nativeMediaDrmBridge) 205 private MediaDrmBridge(UUID schemeUUID, long nativeMediaDrmBridge)
205 throws android.media.UnsupportedSchemeException { 206 throws android.media.UnsupportedSchemeException {
206 mSchemeUUID = schemeUUID; 207 mSchemeUUID = schemeUUID;
207 mMediaDrm = new MediaDrm(schemeUUID); 208 mMediaDrm = new MediaDrm(schemeUUID);
208 209
209 mNativeMediaDrmBridge = nativeMediaDrmBridge; 210 mNativeMediaDrmBridge = nativeMediaDrmBridge;
210 assert isNativeMediaDrmBridgeValid(); 211 assert isNativeMediaDrmBridgeValid();
211 212
212 mHandler = new Handler(); 213 mHandler = new Handler(Looper.getMainLooper());
213 mSessionIds = new HashMap<ByteBuffer, String>(); 214 mSessionIds = new HashMap<ByteBuffer, String>();
214 mPendingCreateSessionDataQueue = new ArrayDeque<PendingCreateSessionData >(); 215 mPendingCreateSessionDataQueue = new ArrayDeque<PendingCreateSessionData >();
215 mResetDeviceCredentialsPending = false; 216 mResetDeviceCredentialsPending = false;
216 mProvisioningPending = false; 217 mProvisioningPending = false;
217 218
218 mMediaDrm.setOnEventListener(new EventListener()); 219 mMediaDrm.setOnEventListener(new EventListener());
219 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 220 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
220 mMediaDrm.setOnExpirationUpdateListener(new ExpirationUpdateListener (), null); 221 mMediaDrm.setOnExpirationUpdateListener(new ExpirationUpdateListener (), null);
221 mMediaDrm.setOnKeyStatusChangeListener(new KeyStatusChangeListener() , null); 222 mMediaDrm.setOnKeyStatusChangeListener(new KeyStatusChangeListener() , null);
222 } 223 }
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 private native void nativeOnSessionKeysChange(long nativeMediaDrmBridge, byt e[] sessionId, 1125 private native void nativeOnSessionKeysChange(long nativeMediaDrmBridge, byt e[] sessionId,
1125 Object[] keysInfo, boolean hasAdditionalUsableKey); 1126 Object[] keysInfo, boolean hasAdditionalUsableKey);
1126 private native void nativeOnSessionExpirationUpdate( 1127 private native void nativeOnSessionExpirationUpdate(
1127 long nativeMediaDrmBridge, byte[] sessionId, long expirationTime); 1128 long nativeMediaDrmBridge, byte[] sessionId, long expirationTime);
1128 private native void nativeOnLegacySessionError( 1129 private native void nativeOnLegacySessionError(
1129 long nativeMediaDrmBridge, byte[] sessionId, String errorMessage); 1130 long nativeMediaDrmBridge, byte[] sessionId, String errorMessage);
1130 1131
1131 private native void nativeOnResetDeviceCredentialsCompleted( 1132 private native void nativeOnResetDeviceCredentialsCompleted(
1132 long nativeMediaDrmBridge, boolean success); 1133 long nativeMediaDrmBridge, boolean success);
1133 } 1134 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698