summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/MediaCodec.cpp
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2015-04-28 19:02:33 -0700
committerAndy Hung <hunga@google.com>2015-04-29 14:10:12 -0700
commit48a31bf3f1c1ed5953a4e64f71cdf528f3a38ee5 (patch)
tree1227f65215a97e0c73a453bb0ffb09ff636ad432 /media/libstagefright/MediaCodec.cpp
parent1e2a0e6adc3d70879b00e5295c54a74209b71e1b (diff)
downloadframeworks_av-48a31bf3f1c1ed5953a4e64f71cdf528f3a38ee5.zip
frameworks_av-48a31bf3f1c1ed5953a4e64f71cdf528f3a38ee5.tar.gz
frameworks_av-48a31bf3f1c1ed5953a4e64f71cdf528f3a38ee5.tar.bz2
Omx: Return an error if no IOMX is available
Previously caused fatal crash. Bug: 20566134 Change-Id: I9761d043422954615dbe81b301401765146a7283
Diffstat (limited to 'media/libstagefright/MediaCodec.cpp')
-rw-r--r--media/libstagefright/MediaCodec.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index aa0d2e6..8a2dc35 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -392,6 +392,10 @@ status_t MediaCodec::init(const AString &name, bool nameIsType, bool encoder) {
tmp.erase(tmp.size() - 7, 7);
}
const sp<IMediaCodecList> mcl = MediaCodecList::getInstance();
+ if (mcl == NULL) {
+ mCodec = NULL; // remove the codec.
+ return NO_INIT; // if called from Java should raise IOException
+ }
ssize_t codecIdx = mcl->findCodecByName(tmp.c_str());
if (codecIdx >= 0) {
const sp<MediaCodecInfo> info = mcl->getCodecInfo(codecIdx);