Loading media/java/android/media/MediaPlayer2.java +10 −6 Original line number Diff line number Diff line Loading @@ -3501,7 +3501,7 @@ public class MediaPlayer2 implements AutoCloseable } } private native void native_releaseDrm(); private native void native_releaseDrm(long mSrcId); /** * A key request/response exchange occurs between the app and a license server Loading Loading @@ -3821,7 +3821,8 @@ public class MediaPlayer2 implements AutoCloseable } } private native void native_prepareDrm(@NonNull byte[] uuid, @NonNull byte[] drmSessionId); private native void native_prepareDrm( long srcId, @NonNull byte[] uuid, @NonNull byte[] drmSessionId); // Instantiated from the native side @SuppressWarnings("unused") Loading Loading @@ -4064,6 +4065,7 @@ public class MediaPlayer2 implements AutoCloseable static final int PROVISION_TIMEOUT_MS = 60000; final DataSourceDesc mDSD; final long mSrcId; //--- guarded by |this| start MediaDrm mDrmObj; Loading @@ -4075,8 +4077,9 @@ public class MediaPlayer2 implements AutoCloseable Future<?> mProvisionResult; //--- guarded by |this| end DrmHandle(DataSourceDesc dsd) { DrmHandle(DataSourceDesc dsd, long srcId) { mDSD = dsd; mSrcId = srcId; } void prepare(UUID uuid) throws UnsupportedSchemeException, Loading Loading @@ -4186,7 +4189,8 @@ public class MediaPlayer2 implements AutoCloseable // Sending it down to native/mediaserver to create the crypto object // This call could simply fail due to bad player state, e.g., after play(). MediaPlayer2.this.native_prepareDrm(getByteArrayFromUUID(uuid), mDrmSessionId); final MediaPlayer2 mp2 = MediaPlayer2.this; mp2.native_prepareDrm(mSrcId, getByteArrayFromUUID(uuid), mDrmSessionId); Log.v(TAG, "prepareDrm_openSessionStep: native_prepareDrm/Crypto succeeded"); } catch (Exception e) { //ResourceBusyException, NotProvisionedException Loading Loading @@ -4367,7 +4371,7 @@ public class MediaPlayer2 implements AutoCloseable // exception if we're in a non-stopped/prepared state. // for cleaning native/mediaserver crypto object native_releaseDrm(); native_releaseDrm(mSrcId); // for cleaning client-side MediaDrm object; only called if above has succeeded cleanDrmObj(); Loading Loading @@ -4573,7 +4577,7 @@ public class MediaPlayer2 implements AutoCloseable SourceInfo(DataSourceDesc dsd) { this.mDSD = dsd; mDrmHandle = new DrmHandle(dsd); mDrmHandle = new DrmHandle(dsd, mId); } void close() { Loading media/jni/android_media_MediaPlayer2.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -1192,7 +1192,7 @@ static Vector<uint8_t> JByteArrayToVector(JNIEnv *env, jbyteArray const &byteArr } static void android_media_MediaPlayer2_prepareDrm(JNIEnv *env, jobject thiz, jbyteArray uuidObj, jbyteArray drmSessionIdObj) jlong srcId, jbyteArray uuidObj, jbyteArray drmSessionIdObj) { sp<MediaPlayer2> mp = getMediaPlayer(env, thiz); if (mp == NULL) { Loading Loading @@ -1225,7 +1225,7 @@ static void android_media_MediaPlayer2_prepareDrm(JNIEnv *env, jobject thiz, return; } status_t err = mp->prepareDrm(uuid.array(), drmSessionId); status_t err = mp->prepareDrm(srcId, uuid.array(), drmSessionId); if (err != OK) { if (err == INVALID_OPERATION) { jniThrowException( Loading @@ -1243,7 +1243,7 @@ static void android_media_MediaPlayer2_prepareDrm(JNIEnv *env, jobject thiz, } } static void android_media_MediaPlayer2_releaseDrm(JNIEnv *env, jobject thiz) static void android_media_MediaPlayer2_releaseDrm(JNIEnv *env, jobject thiz, jlong srcId) { sp<MediaPlayer2> mp = getMediaPlayer(env, thiz); if (mp == NULL ) { Loading @@ -1251,7 +1251,7 @@ static void android_media_MediaPlayer2_releaseDrm(JNIEnv *env, jobject thiz) return; } status_t err = mp->releaseDrm(); status_t err = mp->releaseDrm(srcId); if (err != OK) { if (err == INVALID_OPERATION) { jniThrowException( Loading Loading @@ -1425,8 +1425,8 @@ static const JNINativeMethod gMethods[] = { {"native_setAuxEffectSendLevel", "(F)V", (void *)android_media_MediaPlayer2_setAuxEffectSendLevel}, {"native_attachAuxEffect", "(I)V", (void *)android_media_MediaPlayer2_attachAuxEffect}, // Modular DRM { "native_prepareDrm", "([B[B)V", (void *)android_media_MediaPlayer2_prepareDrm }, { "native_releaseDrm", "()V", (void *)android_media_MediaPlayer2_releaseDrm }, { "native_prepareDrm", "(J[B[B)V", (void *)android_media_MediaPlayer2_prepareDrm }, { "native_releaseDrm", "(J)V", (void *)android_media_MediaPlayer2_releaseDrm }, // AudioRouting {"native_setPreferredDevice", "(Landroid/media/AudioDeviceInfo;)Z", (void *)android_media_MediaPlayer2_setPreferredDevice}, Loading Loading
media/java/android/media/MediaPlayer2.java +10 −6 Original line number Diff line number Diff line Loading @@ -3501,7 +3501,7 @@ public class MediaPlayer2 implements AutoCloseable } } private native void native_releaseDrm(); private native void native_releaseDrm(long mSrcId); /** * A key request/response exchange occurs between the app and a license server Loading Loading @@ -3821,7 +3821,8 @@ public class MediaPlayer2 implements AutoCloseable } } private native void native_prepareDrm(@NonNull byte[] uuid, @NonNull byte[] drmSessionId); private native void native_prepareDrm( long srcId, @NonNull byte[] uuid, @NonNull byte[] drmSessionId); // Instantiated from the native side @SuppressWarnings("unused") Loading Loading @@ -4064,6 +4065,7 @@ public class MediaPlayer2 implements AutoCloseable static final int PROVISION_TIMEOUT_MS = 60000; final DataSourceDesc mDSD; final long mSrcId; //--- guarded by |this| start MediaDrm mDrmObj; Loading @@ -4075,8 +4077,9 @@ public class MediaPlayer2 implements AutoCloseable Future<?> mProvisionResult; //--- guarded by |this| end DrmHandle(DataSourceDesc dsd) { DrmHandle(DataSourceDesc dsd, long srcId) { mDSD = dsd; mSrcId = srcId; } void prepare(UUID uuid) throws UnsupportedSchemeException, Loading Loading @@ -4186,7 +4189,8 @@ public class MediaPlayer2 implements AutoCloseable // Sending it down to native/mediaserver to create the crypto object // This call could simply fail due to bad player state, e.g., after play(). MediaPlayer2.this.native_prepareDrm(getByteArrayFromUUID(uuid), mDrmSessionId); final MediaPlayer2 mp2 = MediaPlayer2.this; mp2.native_prepareDrm(mSrcId, getByteArrayFromUUID(uuid), mDrmSessionId); Log.v(TAG, "prepareDrm_openSessionStep: native_prepareDrm/Crypto succeeded"); } catch (Exception e) { //ResourceBusyException, NotProvisionedException Loading Loading @@ -4367,7 +4371,7 @@ public class MediaPlayer2 implements AutoCloseable // exception if we're in a non-stopped/prepared state. // for cleaning native/mediaserver crypto object native_releaseDrm(); native_releaseDrm(mSrcId); // for cleaning client-side MediaDrm object; only called if above has succeeded cleanDrmObj(); Loading Loading @@ -4573,7 +4577,7 @@ public class MediaPlayer2 implements AutoCloseable SourceInfo(DataSourceDesc dsd) { this.mDSD = dsd; mDrmHandle = new DrmHandle(dsd); mDrmHandle = new DrmHandle(dsd, mId); } void close() { Loading
media/jni/android_media_MediaPlayer2.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -1192,7 +1192,7 @@ static Vector<uint8_t> JByteArrayToVector(JNIEnv *env, jbyteArray const &byteArr } static void android_media_MediaPlayer2_prepareDrm(JNIEnv *env, jobject thiz, jbyteArray uuidObj, jbyteArray drmSessionIdObj) jlong srcId, jbyteArray uuidObj, jbyteArray drmSessionIdObj) { sp<MediaPlayer2> mp = getMediaPlayer(env, thiz); if (mp == NULL) { Loading Loading @@ -1225,7 +1225,7 @@ static void android_media_MediaPlayer2_prepareDrm(JNIEnv *env, jobject thiz, return; } status_t err = mp->prepareDrm(uuid.array(), drmSessionId); status_t err = mp->prepareDrm(srcId, uuid.array(), drmSessionId); if (err != OK) { if (err == INVALID_OPERATION) { jniThrowException( Loading @@ -1243,7 +1243,7 @@ static void android_media_MediaPlayer2_prepareDrm(JNIEnv *env, jobject thiz, } } static void android_media_MediaPlayer2_releaseDrm(JNIEnv *env, jobject thiz) static void android_media_MediaPlayer2_releaseDrm(JNIEnv *env, jobject thiz, jlong srcId) { sp<MediaPlayer2> mp = getMediaPlayer(env, thiz); if (mp == NULL ) { Loading @@ -1251,7 +1251,7 @@ static void android_media_MediaPlayer2_releaseDrm(JNIEnv *env, jobject thiz) return; } status_t err = mp->releaseDrm(); status_t err = mp->releaseDrm(srcId); if (err != OK) { if (err == INVALID_OPERATION) { jniThrowException( Loading Loading @@ -1425,8 +1425,8 @@ static const JNINativeMethod gMethods[] = { {"native_setAuxEffectSendLevel", "(F)V", (void *)android_media_MediaPlayer2_setAuxEffectSendLevel}, {"native_attachAuxEffect", "(I)V", (void *)android_media_MediaPlayer2_attachAuxEffect}, // Modular DRM { "native_prepareDrm", "([B[B)V", (void *)android_media_MediaPlayer2_prepareDrm }, { "native_releaseDrm", "()V", (void *)android_media_MediaPlayer2_releaseDrm }, { "native_prepareDrm", "(J[B[B)V", (void *)android_media_MediaPlayer2_prepareDrm }, { "native_releaseDrm", "(J)V", (void *)android_media_MediaPlayer2_releaseDrm }, // AudioRouting {"native_setPreferredDevice", "(Landroid/media/AudioDeviceInfo;)Z", (void *)android_media_MediaPlayer2_setPreferredDevice}, Loading