summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2015-04-30 01:01:41 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-04-30 01:01:41 +0000
commit426a0c3358099b909f72a34e04af4b0758d28b21 (patch)
tree9a4ec8596e42100751d760130940166bfffae6ef /media
parent3d7765cd6f8e473f458f23de2af62cc4a2d480c6 (diff)
parentf388c9e654781c26debe53a0eecce5b6d9234373 (diff)
downloadframeworks_base-426a0c3358099b909f72a34e04af4b0758d28b21.zip
frameworks_base-426a0c3358099b909f72a34e04af4b0758d28b21.tar.gz
frameworks_base-426a0c3358099b909f72a34e04af4b0758d28b21.tar.bz2
am f388c9e6: am f3d3856f: Merge "Check for null codec from AMediaCodec_createDecoderByType" into mnc-dev
* commit 'f388c9e654781c26debe53a0eecce5b6d9234373': Check for null codec from AMediaCodec_createDecoderByType
Diffstat (limited to 'media')
-rw-r--r--media/jni/soundpool/SoundPool.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/media/jni/soundpool/SoundPool.cpp b/media/jni/soundpool/SoundPool.cpp
index 25c6154..84ae3b4 100644
--- a/media/jni/soundpool/SoundPool.cpp
+++ b/media/jni/soundpool/SoundPool.cpp
@@ -514,10 +514,11 @@ static status_t decode(int fd, int64_t offset, int64_t length,
if (strncmp(mime, "audio/", 6) == 0) {
AMediaCodec *codec = AMediaCodec_createDecoderByType(mime);
- if (AMediaCodec_configure(codec, format,
- NULL /* window */, NULL /* drm */, 0 /* flags */) != AMEDIA_OK
- || AMediaCodec_start(codec) != AMEDIA_OK
- || AMediaExtractor_selectTrack(ex, i) != AMEDIA_OK) {
+ if (codec == NULL
+ || AMediaCodec_configure(codec, format,
+ NULL /* window */, NULL /* drm */, 0 /* flags */) != AMEDIA_OK
+ || AMediaCodec_start(codec) != AMEDIA_OK
+ || AMediaExtractor_selectTrack(ex, i) != AMEDIA_OK) {
AMediaExtractor_delete(ex);
AMediaCodec_delete(codec);
AMediaFormat_delete(format);