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

Commit 76158912 authored by Songyue Han's avatar Songyue Han Committed by Automerger Merge Worker
Browse files

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

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


#include <sstream>

namespace android {
namespace android {


OMXStore::OMXStore() {
OMXStore::OMXStore() {
@@ -108,9 +110,26 @@ static int getFirstApiLevel() {
    return android::base::GetIntProperty("ro.product.first_api_level", __ANDROID_API_T__);
    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) {
void OMXStore::addPlugin(OMXPluginBase *plugin) {
    Mutex::Autolock autoLock(mLock);
    Mutex::Autolock autoLock(mLock);


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

    OMX_U32 index = 0;
    OMX_U32 index = 0;


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