summaryrefslogtreecommitdiffstats
path: root/media/jni
diff options
context:
space:
mode:
authorJeff Tinker <jtinker@google.com>2014-04-21 21:06:13 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-04-21 21:06:13 +0000
commit2152a2c5f93872eac268306dc675558b2489d270 (patch)
tree471189535bc8d91cac980535513151480a465695 /media/jni
parentec687133e01d6650d630511ce96f184c6d829482 (diff)
parente618f184733e745df4cf86019d23e085559e0f2c (diff)
downloadframeworks_base-2152a2c5f93872eac268306dc675558b2489d270.zip
frameworks_base-2152a2c5f93872eac268306dc675558b2489d270.tar.gz
frameworks_base-2152a2c5f93872eac268306dc675558b2489d270.tar.bz2
am e618f184: am 72eec7f6: Merge "Allow DRM plugins to be destroyed when released" into klp-modular-dev
* commit 'e618f184733e745df4cf86019d23e085559e0f2c': Allow DRM plugins to be destroyed when released
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();