MediaCodecList: handle errors gracefully

Handle missing OMX codecs, and codecs that do not load.
Fix NULL dereference when initializing codec with no type.

Bug: 16907578
Bug: 16905025
Change-Id: I5d103db36ebb029d1aab03222bf6e9324beb1566
diff --git a/media/libmedia/MediaCodecInfo.cpp b/media/libmedia/MediaCodecInfo.cpp
index 7900eae..8f47292 100644
--- a/media/libmedia/MediaCodecInfo.cpp
+++ b/media/libmedia/MediaCodecInfo.cpp
@@ -206,6 +206,14 @@
     return OK;
 }
 
+void MediaCodecInfo::removeMime(const char *mime) {
+    ssize_t ix = getCapabilityIndex(mime);
+    if (ix >= 0) {
+        mCaps.removeItemsAt(ix);
+        // mCurrentCaps will be removed when completed
+    }
+}
+
 status_t MediaCodecInfo::initializeCapabilities(const CodecCapabilities &caps) {
     mCurrentCaps->mProfileLevels.clear();
     mCurrentCaps->mColorFormats.clear();