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

Commit 4fb18c88 authored by Lajos Molnar's avatar Lajos Molnar
Browse files

stagefright: list only the first codec for a given name

Now that we allow multiple codec stores and aliases, a codec name
may appear in multiple stores. List only the first codec for a
given name (with the lowest rank).

Allow this logic to be disabled for debugging via setprop
debug.stagefright.dedupe-codecs 0.

Bug: 119631295
Change-Id: I05f8ed86075a263e8becf80433018447f2f18361
parent 8e577c93
Loading
Loading
Loading
Loading
+15 −0
Original line number Original line Diff line number Diff line
@@ -224,6 +224,21 @@ MediaCodecList::MediaCodecList(std::vector<MediaCodecListBuilderBase*> builders)
                return info1 == nullptr
                return info1 == nullptr
                        || (info2 != nullptr && info1->getRank() < info2->getRank());
                        || (info2 != nullptr && info1->getRank() < info2->getRank());
            });
            });

    // remove duplicate entries
    bool dedupe = property_get_bool("debug.stagefright.dedupe-codecs", true);
    if (dedupe) {
        std::set<std::string> codecsSeen;
        for (auto it = mCodecInfos.begin(); it != mCodecInfos.end(); ) {
            std::string codecName = (*it)->getCodecName();
            if (codecsSeen.count(codecName) == 0) {
                codecsSeen.emplace(codecName);
                it++;
            } else {
                it = mCodecInfos.erase(it);
            }
        }
    }
}
}


MediaCodecList::~MediaCodecList() {
MediaCodecList::~MediaCodecList() {