Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c23981d9 authored by Marco Nelissen's avatar Marco Nelissen Committed by Android (Google) Code Review
Browse files

Merge "Better workaround for slow decoders." into klp-dev

parents 36a8b33a 6f9439ef
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -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)) {
    } 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) {