summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2015-04-30 01:21:03 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-04-30 01:21:03 +0000
commit02f6890289bf5f18d40b6f6504baf638f34dd5f5 (patch)
tree717d6c0b8995cff6feb788b9fc51ac44209de69b /media
parentaba56b648fd559d445ba04c3bdfcb9cdb048f729 (diff)
parent426a0c3358099b909f72a34e04af4b0758d28b21 (diff)
downloadframeworks_base-02f6890289bf5f18d40b6f6504baf638f34dd5f5.zip
frameworks_base-02f6890289bf5f18d40b6f6504baf638f34dd5f5.tar.gz
frameworks_base-02f6890289bf5f18d40b6f6504baf638f34dd5f5.tar.bz2
am 426a0c33: am f388c9e6: am f3d3856f: Merge "Check for null codec from AMediaCodec_createDecoderByType" into mnc-dev
* commit '426a0c3358099b909f72a34e04af4b0758d28b21': 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);