summaryrefslogtreecommitdiffstats
path: root/media/jni
diff options
context:
space:
mode:
authorJeff Tinker <jtinker@google.com>2014-04-11 16:11:15 -0700
committerJeff Tinker <jtinker@google.com>2014-04-11 16:11:15 -0700
commit600071ca78bb3fa52b4b3e04112ed6664ffe0e30 (patch)
treef488a1780192c8de8c3f0cc6c64030d57882dd9c /media/jni
parent2e8a2d207f446e156a8cfb9532cdfb569caa9458 (diff)
downloadframeworks_base-600071ca78bb3fa52b4b3e04112ed6664ffe0e30.zip
frameworks_base-600071ca78bb3fa52b4b3e04112ed6664ffe0e30.tar.gz
frameworks_base-600071ca78bb3fa52b4b3e04112ed6664ffe0e30.tar.bz2
Allow DRM plugins to be destroyed when released
bug: 13411994 Change-Id: I5b4ac137ebfbaa61bc37f8344ab6ff3a7f6c0099
Diffstat (limited to 'media/jni')
-rw-r--r--media/jni/android_media_MediaDrm.cpp10
-rw-r--r--media/jni/android_media_MediaDrm.h2
2 files changed, 10 insertions, 2 deletions
diff --git a/media/jni/android_media_MediaDrm.cpp b/media/jni/android_media_MediaDrm.cpp
index 7c45682..4fbd2a4 100644
--- a/media/jni/android_media_MediaDrm.cpp
+++ b/media/jni/android_media_MediaDrm.cpp
@@ -297,8 +297,6 @@ JDrm::JDrm(
}
JDrm::~JDrm() {
- mDrm.clear();
-
JNIEnv *env = AndroidRuntime::getJNIEnv();
env->DeleteWeakGlobalRef(mObject);
@@ -363,6 +361,13 @@ void JDrm::notify(DrmPlugin::EventType eventType, int extra, const Parcel *obj)
}
}
+void JDrm::disconnect() {
+ if (mDrm != NULL) {
+ mDrm->destroyPlugin();
+ mDrm.clear();
+ }
+}
+
// static
bool JDrm::IsCryptoSchemeSupported(const uint8_t uuid[16], const String8 &mimeType) {
@@ -527,6 +532,7 @@ static void android_media_MediaDrm_release(JNIEnv *env, jobject thiz) {
sp<JDrm> drm = setDrm(env, thiz, NULL);
if (drm != NULL) {
drm->setListener(NULL);
+ drm->disconnect();
}
}
diff --git a/media/jni/android_media_MediaDrm.h b/media/jni/android_media_MediaDrm.h
index 620ad28..b7b8e5d 100644
--- a/media/jni/android_media_MediaDrm.h
+++ b/media/jni/android_media_MediaDrm.h
@@ -47,6 +47,8 @@ struct JDrm : public BnDrmClient {
void notify(DrmPlugin::EventType, int extra, const Parcel *obj);
status_t setListener(const sp<DrmListener>& listener);
+ void disconnect();
+
protected:
virtual ~JDrm();