diff options
author | Marco Nelissen <marcone@google.com> | 2013-09-04 15:00:07 -0700 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2013-09-04 15:36:42 -0700 |
commit | 6f9439efd2a6004b588605f6a9d4af20c98e8e80 (patch) | |
tree | 33e81b2244ff78d4735170362fb37ddafd4542c5 /media | |
parent | 491211b87dd38357d37ece687cf8795bff8996a5 (diff) | |
download | frameworks_av-6f9439efd2a6004b588605f6a9d4af20c98e8e80.zip frameworks_av-6f9439efd2a6004b588605f6a9d4af20c98e8e80.tar.gz frameworks_av-6f9439efd2a6004b588605f6a9d4af20c98e8e80.tar.bz2 |
Better workaround for slow decoders.
This is more in the spirit of the original code. Now it checks
whether a codec instantiated by name is a video codec, and enables
the extra looper if so.
b/10528409
Change-Id: Ia253c04c1283d4ecf66f213ef4bf523279ad7cca
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/MediaCodec.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp index 66a0b4e..e0686be 100644 --- a/media/libstagefright/MediaCodec.cpp +++ b/media/libstagefright/MediaCodec.cpp @@ -31,6 +31,7 @@ #include <media/stagefright/foundation/hexdump.h> #include <media/stagefright/ACodec.h> #include <media/stagefright/BufferProducerWrapper.h> +#include <media/stagefright/MediaCodecList.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MetaData.h> @@ -104,10 +105,24 @@ status_t MediaCodec::init(const char *name, bool nameIsType, bool encoder) { bool needDedicatedLooper = false; if (nameIsType && !strncasecmp(name, "video/", 6)) { needDedicatedLooper = true; - } else if (!nameIsType && !strncmp(name, "OMX.TI.DUCATI1.VIDEO.", 21)) { - needDedicatedLooper = true; - } else if (!nameIsType && !strncmp(name, "OMX.qcom.video.decoder.avc.secure", 33)) { - needDedicatedLooper = true; + } else { + AString tmp = name; + if (tmp.endsWith(".secure")) { + tmp.erase(tmp.size() - 7, 7); + } + const MediaCodecList *mcl = MediaCodecList::getInstance(); + ssize_t codecIdx = mcl->findCodecByName(tmp.c_str()); + if (codecIdx >= 0) { + Vector<AString> types; + if (mcl->getSupportedTypes(codecIdx, &types) == OK) { + for (int i = 0; i < types.size(); i++) { + if (types[i].startsWith("video/")) { + needDedicatedLooper = true; + break; + } + } + } + } } if (needDedicatedLooper) { |