summaryrefslogtreecommitdiffstats
path: root/media/jni
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2015-04-28 18:43:03 -0700
committerAndy Hung <hunga@google.com>2015-04-29 14:09:45 -0700
commit26eca01c490f643fc2558be4c5477a1d433a8a07 (patch)
tree83cd0900b29aacc05abc9f9184d0071f060f5215 /media/jni
parentfe48e0dfb9862356cd4af645fb010236fc273a4a (diff)
downloadframeworks_base-26eca01c490f643fc2558be4c5477a1d433a8a07.zip
frameworks_base-26eca01c490f643fc2558be4c5477a1d433a8a07.tar.gz
frameworks_base-26eca01c490f643fc2558be4c5477a1d433a8a07.tar.bz2
Check for null codec from AMediaCodec_createDecoderByType
NULL codec can now occur if codec cannot be created. Bug: 20566134 Change-Id: I08d54e733a01d0614313673dc49a6f5e702633ac
Diffstat (limited to 'media/jni')
-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);