Loading media/codec2/sfplugin/CCodec.cpp +37 −19 Original line number Original line Diff line number Diff line Loading @@ -1948,6 +1948,13 @@ PersistentSurface *CCodec::CreateInputSurface() { inputSurface->getHalInterface())); inputSurface->getHalInterface())); } } static void MaybeLogUnrecognizedName(const char *func, const std::string &name) { thread_local std::set<std::string> sLogged{}; if (sLogged.insert(name).second) { ALOGW("%s: Unrecognized interface name: %s", func, name.c_str()); } } static status_t GetCommonAllocatorIds( static status_t GetCommonAllocatorIds( const std::vector<std::string> &names, const std::vector<std::string> &names, C2Allocator::type_t type, C2Allocator::type_t type, Loading @@ -1961,26 +1968,33 @@ static status_t GetCommonAllocatorIds( if (names.empty()) { if (names.empty()) { return OK; return OK; } } bool firstIteration = true; for (const std::string &name : names) { std::shared_ptr<Codec2Client::Interface> intf{ std::shared_ptr<Codec2Client::Interface> intf{ Codec2Client::CreateInterfaceByName(names[0].c_str())}; Codec2Client::CreateInterfaceByName(name.c_str())}; if (!intf) { MaybeLogUnrecognizedName(__FUNCTION__, name); continue; } std::vector<std::unique_ptr<C2Param>> params; std::vector<std::unique_ptr<C2Param>> params; c2_status_t err = intf->query( c2_status_t err = intf->query( {}, {C2PortAllocatorsTuning::input::PARAM_TYPE}, C2_MAY_BLOCK, ¶ms); {}, {C2PortAllocatorsTuning::input::PARAM_TYPE}, C2_MAY_BLOCK, ¶ms); if (firstIteration) { firstIteration = false; if (err == C2_OK && params.size() == 1u) { if (err == C2_OK && params.size() == 1u) { C2PortAllocatorsTuning::input *allocators = C2PortAllocatorsTuning::input *allocators = C2PortAllocatorsTuning::input::From(params[0].get()); C2PortAllocatorsTuning::input::From(params[0].get()); if (allocators && allocators->flexCount() > 0) { if (allocators && allocators->flexCount() > 0) { ids->insert(allocators->m.values, allocators->m.values + allocators->flexCount()); ids->insert(allocators->m.values, allocators->m.values + allocators->flexCount()); } } } } if (ids->empty()) { if (ids->empty()) { // The component does not advertise allocators. Use default. // The component does not advertise allocators. Use default. ids->insert(defaultAllocatorId); ids->insert(defaultAllocatorId); } } for (size_t i = 1; i < names.size(); ++i) { continue; intf = Codec2Client::CreateInterfaceByName(names[i].c_str()); } err = intf->query( {}, {C2PortAllocatorsTuning::input::PARAM_TYPE}, C2_MAY_BLOCK, ¶ms); bool filtered = false; bool filtered = false; if (err == C2_OK && params.size() == 1u) { if (err == C2_OK && params.size() == 1u) { C2PortAllocatorsTuning::input *allocators = C2PortAllocatorsTuning::input *allocators = Loading Loading @@ -2033,6 +2047,10 @@ static status_t CalculateMinMaxUsage( for (const std::string &name : names) { for (const std::string &name : names) { std::shared_ptr<Codec2Client::Interface> intf{ std::shared_ptr<Codec2Client::Interface> intf{ Codec2Client::CreateInterfaceByName(name.c_str())}; Codec2Client::CreateInterfaceByName(name.c_str())}; if (!intf) { MaybeLogUnrecognizedName(__FUNCTION__, name); continue; } std::vector<C2FieldSupportedValuesQuery> fields; std::vector<C2FieldSupportedValuesQuery> fields; fields.push_back(C2FieldSupportedValuesQuery::Possible( fields.push_back(C2FieldSupportedValuesQuery::Possible( C2ParamField{&sUsage, &sUsage.value})); C2ParamField{&sUsage, &sUsage.value})); Loading Loading
media/codec2/sfplugin/CCodec.cpp +37 −19 Original line number Original line Diff line number Diff line Loading @@ -1948,6 +1948,13 @@ PersistentSurface *CCodec::CreateInputSurface() { inputSurface->getHalInterface())); inputSurface->getHalInterface())); } } static void MaybeLogUnrecognizedName(const char *func, const std::string &name) { thread_local std::set<std::string> sLogged{}; if (sLogged.insert(name).second) { ALOGW("%s: Unrecognized interface name: %s", func, name.c_str()); } } static status_t GetCommonAllocatorIds( static status_t GetCommonAllocatorIds( const std::vector<std::string> &names, const std::vector<std::string> &names, C2Allocator::type_t type, C2Allocator::type_t type, Loading @@ -1961,26 +1968,33 @@ static status_t GetCommonAllocatorIds( if (names.empty()) { if (names.empty()) { return OK; return OK; } } bool firstIteration = true; for (const std::string &name : names) { std::shared_ptr<Codec2Client::Interface> intf{ std::shared_ptr<Codec2Client::Interface> intf{ Codec2Client::CreateInterfaceByName(names[0].c_str())}; Codec2Client::CreateInterfaceByName(name.c_str())}; if (!intf) { MaybeLogUnrecognizedName(__FUNCTION__, name); continue; } std::vector<std::unique_ptr<C2Param>> params; std::vector<std::unique_ptr<C2Param>> params; c2_status_t err = intf->query( c2_status_t err = intf->query( {}, {C2PortAllocatorsTuning::input::PARAM_TYPE}, C2_MAY_BLOCK, ¶ms); {}, {C2PortAllocatorsTuning::input::PARAM_TYPE}, C2_MAY_BLOCK, ¶ms); if (firstIteration) { firstIteration = false; if (err == C2_OK && params.size() == 1u) { if (err == C2_OK && params.size() == 1u) { C2PortAllocatorsTuning::input *allocators = C2PortAllocatorsTuning::input *allocators = C2PortAllocatorsTuning::input::From(params[0].get()); C2PortAllocatorsTuning::input::From(params[0].get()); if (allocators && allocators->flexCount() > 0) { if (allocators && allocators->flexCount() > 0) { ids->insert(allocators->m.values, allocators->m.values + allocators->flexCount()); ids->insert(allocators->m.values, allocators->m.values + allocators->flexCount()); } } } } if (ids->empty()) { if (ids->empty()) { // The component does not advertise allocators. Use default. // The component does not advertise allocators. Use default. ids->insert(defaultAllocatorId); ids->insert(defaultAllocatorId); } } for (size_t i = 1; i < names.size(); ++i) { continue; intf = Codec2Client::CreateInterfaceByName(names[i].c_str()); } err = intf->query( {}, {C2PortAllocatorsTuning::input::PARAM_TYPE}, C2_MAY_BLOCK, ¶ms); bool filtered = false; bool filtered = false; if (err == C2_OK && params.size() == 1u) { if (err == C2_OK && params.size() == 1u) { C2PortAllocatorsTuning::input *allocators = C2PortAllocatorsTuning::input *allocators = Loading Loading @@ -2033,6 +2047,10 @@ static status_t CalculateMinMaxUsage( for (const std::string &name : names) { for (const std::string &name : names) { std::shared_ptr<Codec2Client::Interface> intf{ std::shared_ptr<Codec2Client::Interface> intf{ Codec2Client::CreateInterfaceByName(name.c_str())}; Codec2Client::CreateInterfaceByName(name.c_str())}; if (!intf) { MaybeLogUnrecognizedName(__FUNCTION__, name); continue; } std::vector<C2FieldSupportedValuesQuery> fields; std::vector<C2FieldSupportedValuesQuery> fields; fields.push_back(C2FieldSupportedValuesQuery::Possible( fields.push_back(C2FieldSupportedValuesQuery::Possible( C2ParamField{&sUsage, &sUsage.value})); C2ParamField{&sUsage, &sUsage.value})); Loading