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

Commit ed71a121 authored by qiang yin's avatar qiang yin Committed by Jerry Wong
Browse files

Add for Dolby thumbnail

There are many Dolby components.
If the right component is at the back of the codec list,
it will take much time to show thumbnail.

Test: Dolby thumbnail show in time.

Bug: 197069927
Change-Id: Id196493ccbdc0a67764458cf14de651b8935d363
Merged-In: Id196493ccbdc0a67764458cf14de651b8935d363
(cherry picked from commit b5cf9ea7)
parent f70982c7
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -225,10 +225,17 @@ sp<IMemory> StagefrightMetadataRetriever::getImageInternal(
            "media.stagefright.thumbnail.prefer_hw_codecs", false);
    uint32_t flags = preferhw ? 0 : MediaCodecList::kPreferSoftwareCodecs;
    Vector<AString> matchingCodecs;
    sp<AMessage> format = new AMessage;
    status_t err = convertMetaDataToMessage(trackMeta, &format);
    if (err != OK) {
        format = NULL;
    }

    MediaCodecList::findMatchingCodecs(
            mime,
            false, /* encoder */
            flags,
            format,
            &matchingCodecs);

    for (size_t i = 0; i < matchingCodecs.size(); ++i) {
@@ -348,11 +355,18 @@ sp<IMemory> StagefrightMetadataRetriever::getFrameInternal(
    bool preferhw = property_get_bool(
            "media.stagefright.thumbnail.prefer_hw_codecs", false);
    uint32_t flags = preferhw ? 0 : MediaCodecList::kPreferSoftwareCodecs;
    sp<AMessage> format = new AMessage;
    status_t err = convertMetaDataToMessage(trackMeta, &format);
    if (err != OK) {
        format = NULL;
    }

    Vector<AString> matchingCodecs;
    MediaCodecList::findMatchingCodecs(
            mime,
            false, /* encoder */
            flags,
            format,
            &matchingCodecs);

    for (size_t i = 0; i < matchingCodecs.size(); ++i) {
+23 −0
Original line number Diff line number Diff line
@@ -509,6 +509,29 @@ bool MediaCodecList::codecHandlesFormat(const char *mime, sp<MediaCodecInfo> inf
                }
            }
        }

        int32_t profile = -1;
        if (format->findInt32("profile", &profile)) {
            int32_t level = -1;
            format->findInt32("level", &level);
            Vector<MediaCodecInfo::ProfileLevel> profileLevels;
            capabilities->getSupportedProfileLevels(&profileLevels);
            auto it = profileLevels.begin();
            for (; it != profileLevels.end(); ++it) {
                if (profile != it->mProfile) {
                    continue;
                }
                if (level > -1 && level > it->mLevel) {
                    continue;
                }
                break;
            }

            if (it == profileLevels.end()) {
                ALOGV("Codec does not support profile %d with level %d", profile, level);
                return false;
            }
        }
    }

    // haven't found a reason to discard this one