diff options
Diffstat (limited to 'media/codec2/hal/hidl/1.2/utils/ComponentStore.cpp')
-rw-r--r-- | media/codec2/hal/hidl/1.2/utils/ComponentStore.cpp | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/media/codec2/hal/hidl/1.2/utils/ComponentStore.cpp b/media/codec2/hal/hidl/1.2/utils/ComponentStore.cpp index 9fac5d5268..f89c83586f 100644 --- a/media/codec2/hal/hidl/1.2/utils/ComponentStore.cpp +++ b/media/codec2/hal/hidl/1.2/utils/ComponentStore.cpp @@ -194,6 +194,36 @@ std::shared_ptr<FilterWrapper> ComponentStore::GetFilterWrapper() { } #endif +std::shared_ptr<MultiAccessUnitInterface> ComponentStore::tryCreateMultiAccessUnitInterface( + const std::shared_ptr<C2ComponentInterface> &c2interface) { + std::shared_ptr<MultiAccessUnitInterface> multiAccessUnitIntf = nullptr; + if (c2interface == nullptr) { + return nullptr; + } + if (MultiAccessUnitHelper::isEnabledOnPlatform()) { + c2_status_t err = C2_OK; + C2ComponentDomainSetting domain; + std::vector<std::unique_ptr<C2Param>> heapParams; + err = c2interface->query_vb({&domain}, {}, C2_MAY_BLOCK, &heapParams); + if (err == C2_OK && (domain.value == C2Component::DOMAIN_AUDIO)) { + std::vector<std::shared_ptr<C2ParamDescriptor>> params; + bool isComponentSupportsLargeAudioFrame = false; + c2interface->querySupportedParams_nb(¶ms); + for (const auto ¶mDesc : params) { + if (paramDesc->name().compare(C2_PARAMKEY_OUTPUT_LARGE_FRAME) == 0) { + isComponentSupportsLargeAudioFrame = true; + break; + } + } + if (!isComponentSupportsLargeAudioFrame) { + multiAccessUnitIntf = std::make_shared<MultiAccessUnitInterface>( + c2interface, std::static_pointer_cast<C2ReflectorHelper>(mParamReflector)); + } + } + } + return multiAccessUnitIntf; +} + // Methods from ::android::hardware::media::c2::V1_0::IComponentStore Return<void> ComponentStore::createComponent( const hidl_string& name, @@ -241,7 +271,9 @@ Return<void> ComponentStore::createInterface( c2interface = GetFilterWrapper()->maybeWrapInterface(c2interface); #endif onInterfaceLoaded(c2interface); - interface = new ComponentInterface(c2interface, mParameterCache); + std::shared_ptr<MultiAccessUnitInterface> multiAccessUnitIntf = + tryCreateMultiAccessUnitInterface(c2interface); + interface = new ComponentInterface(c2interface, multiAccessUnitIntf, mParameterCache); } _hidl_cb(static_cast<Status>(res), interface); return Void(); |