summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2012-07-13 13:01:06 +0300
committerJean-Baptiste Queru <jbq@google.com>2012-08-13 08:47:01 -0700
commite68323325b398eee98d5c81a6024d377ebc48bc1 (patch)
treed54cf4738d9908bc6e674f96eeb813d8af2f5c7f /media
parent37548994e69292932e9e2fafb7cba6c53e3a2bcd (diff)
downloadframeworks_base-e68323325b398eee98d5c81a6024d377ebc48bc1.zip
frameworks_base-e68323325b398eee98d5c81a6024d377ebc48bc1.tar.gz
frameworks_base-e68323325b398eee98d5c81a6024d377ebc48bc1.tar.bz2
mediacodec: Don't crash if trying to open a codec that does not exist
Change-Id: If75e3156517993629f50622a84a9ac573fced815
Diffstat (limited to 'media')
-rw-r--r--media/jni/android_media_MediaCodec.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp
index e43e66e..4941ae5 100644
--- a/media/jni/android_media_MediaCodec.cpp
+++ b/media/jni/android_media_MediaCodec.cpp
@@ -96,7 +96,10 @@ status_t JMediaCodec::initCheck() const {
}
JMediaCodec::~JMediaCodec() {
- mCodec->release();
+ if (mCodec != NULL) {
+ mCodec->release();
+ mCodec.clear();
+ }
JNIEnv *env = AndroidRuntime::getJNIEnv();