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

Commit ad44d135 authored by Songyue Han's avatar Songyue Han Committed by Android (Google) Code Review
Browse files

Merge "don't skip omx video codecs for ATV S and below" into tm-dev

parents 89324d36 5381ebe9
Loading
Loading
Loading
Loading
+24 −2
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@
#include <dlfcn.h>
#include <fcntl.h>

#include <sstream>

namespace android {

OMXStore::OMXStore() {
@@ -108,9 +110,26 @@ static int getFirstApiLevel() {
    return android::base::GetIntProperty("ro.product.first_api_level", __ANDROID_API_T__);
}

static bool isTV() {
    static const bool kIsTv = []() {
        std::string characteristics = android::base::GetProperty("ro.build.characteristics", "");
        std::stringstream ss(characteristics);
        for (std::string item; std::getline(ss, item, ','); ) {
            if (item == "tv") {
                return true;
            }
        }
        return false;
    }();
    return kIsTv;
}

void OMXStore::addPlugin(OMXPluginBase *plugin) {
    Mutex::Autolock autoLock(mLock);

    bool typeTV = isTV();
    int firstApiLevel = getFirstApiLevel();

    OMX_U32 index = 0;

    char name[128];
@@ -125,13 +144,16 @@ void OMXStore::addPlugin(OMXPluginBase *plugin) {
            bool skip = false;
            for (String8 role : roles) {
                if (role.find("video_decoder") != -1 || role.find("video_encoder") != -1) {
                    if (getFirstApiLevel() >= __ANDROID_API_S__) {
                    if (firstApiLevel >= __ANDROID_API_T__) {
                        skip = true;
                        break;
                    } else if (!typeTV && firstApiLevel >= __ANDROID_API_S__) {
                        skip = true;
                        break;
                    }
                }
                if (role.find("audio_decoder") != -1 || role.find("audio_encoder") != -1) {
                    if (getFirstApiLevel() >= __ANDROID_API_T__) {
                    if (firstApiLevel >= __ANDROID_API_T__) {
                        skip = true;
                        break;
                    }