Loading media/codec2/components/base/SimpleC2Interface.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,14 @@ namespace android { /* SimpleInterface */ static C2R SubscribedParamIndicesSetter( bool mayBlock, C2InterfaceHelper::C2P<C2SubscribedParamIndicesTuning> &me) { (void)mayBlock; (void)me; return C2R::Ok(); } SimpleInterface<void>::BaseParams::BaseParams( const std::shared_ptr<C2ReflectorHelper> &reflector, C2String name, Loading Loading @@ -186,7 +194,7 @@ SimpleInterface<void>::BaseParams::BaseParams( .withDefault(C2SubscribedParamIndicesTuning::AllocShared(0u)) .withFields({ C2F(mSubscribedParamIndices, m.values[0]).any(), C2F(mSubscribedParamIndices, m.values).any() }) .withSetter(Setter<C2SubscribedParamIndicesTuning>::NonStrictValuesWithNoDeps) .withSetter(SubscribedParamIndicesSetter) .build()); /* TODO Loading media/codec2/components/base/include/SimpleC2Interface.h +1 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,7 @@ struct Setter { return me.F(me.v.value).validatePossible(me.v.value); } // TODO(b/230146771): fix crash static C2R NonStrictValuesWithNoDeps( bool mayBlock, C2InterfaceHelper::C2P<type> &me) { (void)mayBlock; Loading media/codec2/sfplugin/CCodec.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #include <android/hardware/media/c2/1.0/IInputSurface.h> #include <android/hardware/media/omx/1.0/IGraphicBufferSource.h> #include <android/hardware/media/omx/1.0/IOmx.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <cutils/properties.h> #include <gui/IGraphicBufferProducer.h> Loading Loading @@ -1011,7 +1012,9 @@ void CCodec::configure(const sp<AMessage> &msg) { // Query vendor format for Flexible YUV std::vector<std::unique_ptr<C2Param>> heapParams; C2StoreFlexiblePixelFormatDescriptorsInfo *pixelFormatInfo = nullptr; if (mClient->query( int vendorSdkVersion = base::GetIntProperty( "ro.vendor.build.version.sdk", android_get_device_api_level()); if (vendorSdkVersion >= __ANDROID_API_S__ && mClient->query( {}, {C2StoreFlexiblePixelFormatDescriptorsInfo::PARAM_TYPE}, C2_MAY_BLOCK, Loading media/codec2/sfplugin/CCodecConfig.cpp +13 −5 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ #include <log/log.h> #include <utils/NativeHandle.h> #include <android-base/properties.h> #include <C2Component.h> #include <C2Param.h> #include <util/C2InterfaceHelper.h> Loading Loading @@ -1111,15 +1113,21 @@ status_t CCodecConfig::subscribeToConfigUpdate( const std::shared_ptr<Codec2Client::Configurable> &configurable, const std::vector<C2Param::Index> &indices, c2_blocking_t blocking) { static const int32_t kProductFirstApiLevel = base::GetIntProperty<int32_t>("ro.product.first_api_level", 0); static const int32_t kBoardApiLevel = base::GetIntProperty<int32_t>("ro.board.first_api_level", 0); static const int32_t kFirstApiLevel = (kBoardApiLevel != 0) ? kBoardApiLevel : kProductFirstApiLevel; mSubscribedIndices.insert(indices.begin(), indices.end()); // TODO: enable this when components no longer crash on this config if (mSubscribedIndices.size() != mSubscribedIndicesSize && false) { std::vector<uint32_t> indices; if (mSubscribedIndices.size() != mSubscribedIndicesSize && kFirstApiLevel >= __ANDROID_API_T__) { std::vector<uint32_t> indicesVector; for (C2Param::Index ix : mSubscribedIndices) { indices.push_back(ix); indicesVector.push_back(ix); } std::unique_ptr<C2SubscribedParamIndicesTuning> subscribeTuning = C2SubscribedParamIndicesTuning::AllocUnique(indices); C2SubscribedParamIndicesTuning::AllocUnique(indicesVector); std::vector<std::unique_ptr<C2SettingResult>> results; c2_status_t c2Err = configurable->config({ subscribeTuning.get() }, blocking, &results); if (c2Err != C2_OK && c2Err != C2_BAD_INDEX) { Loading media/libstagefright/omx/OMXStore.cpp +32 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,15 @@ void OMXStore::addPlugin(const char *libname) { } } static int getFirstApiLevel() { int boardApiLevel = android::base::GetIntProperty("ro.board.first_api_level", 0); if (boardApiLevel != 0) { return boardApiLevel; } return android::base::GetIntProperty("ro.product.first_api_level", __ANDROID_API_T__); } void OMXStore::addPlugin(OMXPluginBase *plugin) { Mutex::Autolock autoLock(mLock); Loading @@ -110,6 +119,29 @@ void OMXStore::addPlugin(OMXPluginBase *plugin) { name, sizeof(name), index++)) == OMX_ErrorNone) { String8 name8(name); Vector<String8> roles; OMX_ERRORTYPE err = plugin->getRolesOfComponent(name, &roles); if (err == OMX_ErrorNone) { bool skip = false; for (String8 role : roles) { if (role.find("video_decoder") != -1 || role.find("video_encoder") != -1) { if (getFirstApiLevel() >= __ANDROID_API_S__) { skip = true; break; } } if (role.find("audio_decoder") != -1 || role.find("audio_encoder") != -1) { if (getFirstApiLevel() >= __ANDROID_API_T__) { skip = true; break; } } } if (skip) { continue; } } if (mPluginByComponentName.indexOfKey(name8) >= 0) { ALOGE("A component of name '%s' already exists, ignoring this one.", name8.string()); Loading Loading
media/codec2/components/base/SimpleC2Interface.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,14 @@ namespace android { /* SimpleInterface */ static C2R SubscribedParamIndicesSetter( bool mayBlock, C2InterfaceHelper::C2P<C2SubscribedParamIndicesTuning> &me) { (void)mayBlock; (void)me; return C2R::Ok(); } SimpleInterface<void>::BaseParams::BaseParams( const std::shared_ptr<C2ReflectorHelper> &reflector, C2String name, Loading Loading @@ -186,7 +194,7 @@ SimpleInterface<void>::BaseParams::BaseParams( .withDefault(C2SubscribedParamIndicesTuning::AllocShared(0u)) .withFields({ C2F(mSubscribedParamIndices, m.values[0]).any(), C2F(mSubscribedParamIndices, m.values).any() }) .withSetter(Setter<C2SubscribedParamIndicesTuning>::NonStrictValuesWithNoDeps) .withSetter(SubscribedParamIndicesSetter) .build()); /* TODO Loading
media/codec2/components/base/include/SimpleC2Interface.h +1 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,7 @@ struct Setter { return me.F(me.v.value).validatePossible(me.v.value); } // TODO(b/230146771): fix crash static C2R NonStrictValuesWithNoDeps( bool mayBlock, C2InterfaceHelper::C2P<type> &me) { (void)mayBlock; Loading
media/codec2/sfplugin/CCodec.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #include <android/hardware/media/c2/1.0/IInputSurface.h> #include <android/hardware/media/omx/1.0/IGraphicBufferSource.h> #include <android/hardware/media/omx/1.0/IOmx.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <cutils/properties.h> #include <gui/IGraphicBufferProducer.h> Loading Loading @@ -1011,7 +1012,9 @@ void CCodec::configure(const sp<AMessage> &msg) { // Query vendor format for Flexible YUV std::vector<std::unique_ptr<C2Param>> heapParams; C2StoreFlexiblePixelFormatDescriptorsInfo *pixelFormatInfo = nullptr; if (mClient->query( int vendorSdkVersion = base::GetIntProperty( "ro.vendor.build.version.sdk", android_get_device_api_level()); if (vendorSdkVersion >= __ANDROID_API_S__ && mClient->query( {}, {C2StoreFlexiblePixelFormatDescriptorsInfo::PARAM_TYPE}, C2_MAY_BLOCK, Loading
media/codec2/sfplugin/CCodecConfig.cpp +13 −5 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ #include <log/log.h> #include <utils/NativeHandle.h> #include <android-base/properties.h> #include <C2Component.h> #include <C2Param.h> #include <util/C2InterfaceHelper.h> Loading Loading @@ -1111,15 +1113,21 @@ status_t CCodecConfig::subscribeToConfigUpdate( const std::shared_ptr<Codec2Client::Configurable> &configurable, const std::vector<C2Param::Index> &indices, c2_blocking_t blocking) { static const int32_t kProductFirstApiLevel = base::GetIntProperty<int32_t>("ro.product.first_api_level", 0); static const int32_t kBoardApiLevel = base::GetIntProperty<int32_t>("ro.board.first_api_level", 0); static const int32_t kFirstApiLevel = (kBoardApiLevel != 0) ? kBoardApiLevel : kProductFirstApiLevel; mSubscribedIndices.insert(indices.begin(), indices.end()); // TODO: enable this when components no longer crash on this config if (mSubscribedIndices.size() != mSubscribedIndicesSize && false) { std::vector<uint32_t> indices; if (mSubscribedIndices.size() != mSubscribedIndicesSize && kFirstApiLevel >= __ANDROID_API_T__) { std::vector<uint32_t> indicesVector; for (C2Param::Index ix : mSubscribedIndices) { indices.push_back(ix); indicesVector.push_back(ix); } std::unique_ptr<C2SubscribedParamIndicesTuning> subscribeTuning = C2SubscribedParamIndicesTuning::AllocUnique(indices); C2SubscribedParamIndicesTuning::AllocUnique(indicesVector); std::vector<std::unique_ptr<C2SettingResult>> results; c2_status_t c2Err = configurable->config({ subscribeTuning.get() }, blocking, &results); if (c2Err != C2_OK && c2Err != C2_BAD_INDEX) { Loading
media/libstagefright/omx/OMXStore.cpp +32 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,15 @@ void OMXStore::addPlugin(const char *libname) { } } static int getFirstApiLevel() { int boardApiLevel = android::base::GetIntProperty("ro.board.first_api_level", 0); if (boardApiLevel != 0) { return boardApiLevel; } return android::base::GetIntProperty("ro.product.first_api_level", __ANDROID_API_T__); } void OMXStore::addPlugin(OMXPluginBase *plugin) { Mutex::Autolock autoLock(mLock); Loading @@ -110,6 +119,29 @@ void OMXStore::addPlugin(OMXPluginBase *plugin) { name, sizeof(name), index++)) == OMX_ErrorNone) { String8 name8(name); Vector<String8> roles; OMX_ERRORTYPE err = plugin->getRolesOfComponent(name, &roles); if (err == OMX_ErrorNone) { bool skip = false; for (String8 role : roles) { if (role.find("video_decoder") != -1 || role.find("video_encoder") != -1) { if (getFirstApiLevel() >= __ANDROID_API_S__) { skip = true; break; } } if (role.find("audio_decoder") != -1 || role.find("audio_encoder") != -1) { if (getFirstApiLevel() >= __ANDROID_API_T__) { skip = true; break; } } } if (skip) { continue; } } if (mPluginByComponentName.indexOfKey(name8) >= 0) { ALOGE("A component of name '%s' already exists, ignoring this one.", name8.string()); Loading