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

Commit 6f9439ef authored by Marco Nelissen's avatar Marco Nelissen
Browse files

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
parent 491211b8
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) {