Loading media/codec2/hal/aidl/Component.cpp +30 −27 Original line number Original line Diff line number Diff line Loading @@ -294,47 +294,50 @@ ScopedAStatus Component::createBlockPool( static constexpr IComponent::BlockPoolAllocator::Tag IGBA = static constexpr IComponent::BlockPoolAllocator::Tag IGBA = IComponent::BlockPoolAllocator::allocator; IComponent::BlockPoolAllocator::allocator; c2_status_t status = C2_OK; c2_status_t status = C2_OK; ::android::C2PlatformAllocatorDesc allocatorParam; switch (allocator.getTag()) { switch (allocator.getTag()) { case ALLOCATOR_ID: case ALLOCATOR_ID: { allocatorParam.allocatorId = allocator.get<IComponent::BlockPoolAllocator::allocatorId>(); } break; case IGBA: { allocatorParam.allocatorId = ::android::C2PlatformAllocatorStore::IGBA; allocatorParam.igba = allocator.get<IComponent::BlockPoolAllocator::allocator>().igba; allocatorParam.waitableFd.reset( allocator.get<IComponent::BlockPoolAllocator::allocator>() .waitableFd.dup().release()); } break; default: return ScopedAStatus::fromServiceSpecificError(C2_CORRUPTED); } #ifdef __ANDROID_APEX__ #ifdef __ANDROID_APEX__ status = ::android::CreateCodec2BlockPool( status = ::android::CreateCodec2BlockPool( static_cast<::android::C2PlatformAllocatorStore::id_t>( allocatorParam, allocator.get<ALLOCATOR_ID>()), mComponent, mComponent, &c2BlockPool); &c2BlockPool); #else #else status = ComponentStore::GetFilterWrapper()->createBlockPool( status = ComponentStore::GetFilterWrapper()->createBlockPool( static_cast<::android::C2PlatformAllocatorStore::id_t>( allocatorParam, allocator.get<ALLOCATOR_ID>()), mComponent, mComponent, &c2BlockPool); &c2BlockPool); #endif #endif if (status != C2_OK) { if (status != C2_OK) { blockPool = nullptr; return ScopedAStatus::fromServiceSpecificError(status); } break; case IGBA: // FIXME break; default: break; } } if (blockPool) { { mBlockPoolsMutex.lock(); mBlockPoolsMutex.lock(); mBlockPools.emplace(c2BlockPool->getLocalId(), c2BlockPool); mBlockPools.emplace(c2BlockPool->getLocalId(), c2BlockPool); mBlockPoolsMutex.unlock(); mBlockPoolsMutex.unlock(); } else if (status == C2_OK) { status = C2_CORRUPTED; } } blockPool->blockPoolId = c2BlockPool ? c2BlockPool->getLocalId() : 0; blockPool->blockPoolId = c2BlockPool ? c2BlockPool->getLocalId() : 0; blockPool->configurable = SharedRefBase::make<CachedConfigurable>( blockPool->configurable = SharedRefBase::make<CachedConfigurable>( std::make_unique<BlockPoolIntf>(c2BlockPool)); std::make_unique<BlockPoolIntf>(c2BlockPool)); if (status == C2_OK) { return ScopedAStatus::ok(); return ScopedAStatus::ok(); } } return ScopedAStatus::fromServiceSpecificError(status); } ScopedAStatus Component::destroyBlockPool(int64_t blockPoolId) { ScopedAStatus Component::destroyBlockPool(int64_t blockPoolId) { std::lock_guard<std::mutex> lock(mBlockPoolsMutex); std::lock_guard<std::mutex> lock(mBlockPoolsMutex); Loading media/codec2/hal/client/client.cpp +216 −17 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,8 @@ #define ATRACE_TAG ATRACE_TAG_VIDEO #define ATRACE_TAG ATRACE_TAG_VIDEO #include <android-base/logging.h> #include <android-base/logging.h> #include <utils/Trace.h> #include <utils/Trace.h> #include <codec2/aidl/GraphicBufferAllocator.h> #include <codec2/hidl/client.h> #include <codec2/hidl/client.h> #include <C2Debug.h> #include <C2Debug.h> #include <C2BufferPriv.h> #include <C2BufferPriv.h> Loading Loading @@ -74,6 +76,7 @@ #include <limits> #include <limits> #include <map> #include <map> #include <mutex> #include <mutex> #include <optional> #include <sstream> #include <sstream> #include <thread> #include <thread> #include <type_traits> #include <type_traits> Loading @@ -96,6 +99,9 @@ using H2BGraphicBufferProducer2 = ::android::hardware::graphics::bufferqueue:: V2_0::utils::H2BGraphicBufferProducer; V2_0::utils::H2BGraphicBufferProducer; using ::android::hardware::media::c2::V1_2::SurfaceSyncObj; using ::android::hardware::media::c2::V1_2::SurfaceSyncObj; using AidlGraphicBufferAllocator = ::aidl::android::hardware::media::c2:: implementation::GraphicBufferAllocator; namespace bufferpool2_aidl = ::aidl::android::hardware::media::bufferpool2; namespace bufferpool2_aidl = ::aidl::android::hardware::media::bufferpool2; namespace bufferpool_hidl = ::android::hardware::media::bufferpool::V2_0; namespace bufferpool_hidl = ::android::hardware::media::bufferpool::V2_0; namespace c2_aidl = ::aidl::android::hardware::media::c2; namespace c2_aidl = ::aidl::android::hardware::media::c2; Loading Loading @@ -1041,6 +1047,85 @@ struct Codec2Client::Component::OutputBufferQueue : } } }; }; // The class holds GraphicBufferAllocator and the associated id of // HAL side BlockPool. // This is tightly coupled with BlockPool creation and destruction. // The life cycle inside class will be as follows. // // On createBlockPool client request. // 1. this::create() creates a GraphicBufferAllocator and set it as // the current. // 2. C2AIDL_HAL::createBlockPool() creates a C2BlockPool using // the GraphicBufferAllocator created in #1. // 3. this::setCurrentId() associates the id returned in #2 to the current // // On destroyBlockPool cliet request // 1. C2AIDL_HAL::destroyBlockPool() destroys the block pool // from HAL process. // 2. this::remove() destroys GraphicBufferAllocator which is associatted // with the C2BlockPool in #1. // struct Codec2Client::Component::GraphicBufferAllocators { private: std::optional<C2BlockPool::local_id_t> mCurrentId; std::shared_ptr<AidlGraphicBufferAllocator> mCurrent; // A new BlockPool is created before the old BlockPool is destroyed. // This holds the reference of the old BlockPool when a new BlockPool is // created until the old BlockPool is explicitly requested for destruction. std::map<C2BlockPool::local_id_t, std::shared_ptr<AidlGraphicBufferAllocator>> mOlds; std::mutex mMutex; public: // Creates a GraphicBufferAllocator which will be passed to HAL // for creating C2BlockPool. And the created GraphicBufferAllocator // will be used afterwards by current(). std::shared_ptr<AidlGraphicBufferAllocator> create() { std::unique_lock<std::mutex> l(mMutex); if (mCurrent) { // If this is not stopped. mCurrent->reset(); if (mCurrentId.has_value()) { mOlds.emplace(mCurrentId.value(), mCurrent); } mCurrentId.reset(); mCurrent.reset(); } // TODO: integrate initial value with CCodec/CCodecBufferChannel mCurrent = AidlGraphicBufferAllocator::CreateGraphicBufferAllocator(3 /* maxDequeueCount */); ALOGD("GraphicBufferAllocator created"); return mCurrent; } // Associates the blockpool Id returned from HAL to the // current GraphicBufferAllocator. void setCurrentId(C2BlockPool::local_id_t id) { std::unique_lock<std::mutex> l(mMutex); CHECK(!mCurrentId.has_value()); mCurrentId = id; } // Returns the current GraphicBufferAllocator. std::shared_ptr<AidlGraphicBufferAllocator> current() { std::unique_lock<std::mutex> l(mMutex); return mCurrent; } // Removes the GraphicBufferAllocator associated with given \p id. void remove(C2BlockPool::local_id_t id) { std::unique_lock<std::mutex> l(mMutex); mOlds.erase(id); if (mCurrentId == id) { if (mCurrent) { mCurrent->reset(); mCurrent.reset(); } mCurrentId.reset(); } } }; // Codec2Client // Codec2Client Codec2Client::Codec2Client(sp<HidlBase> const& base, Codec2Client::Codec2Client(sp<HidlBase> const& base, sp<c2_hidl::IConfigurable> const& configurable, sp<c2_hidl::IConfigurable> const& configurable, Loading Loading @@ -1125,6 +1210,7 @@ c2_status_t Codec2Client::createComponent( << status << "."; << status << "."; } } (*component)->mAidlBufferPoolSender->setReceiver(mAidlHostPoolManager); (*component)->mAidlBufferPoolSender->setReceiver(mAidlHostPoolManager); aidlListener->component = *component; return status; return status; } } Loading Loading @@ -1951,7 +2037,7 @@ Codec2Client::Component::Component(const std::shared_ptr<AidlBase> &base) }, }, mAidlBase{base}, mAidlBase{base}, mAidlBufferPoolSender{std::make_unique<AidlBufferPoolSender>()}, mAidlBufferPoolSender{std::make_unique<AidlBufferPoolSender>()}, mOutputBufferQueue{std::make_unique<OutputBufferQueue>()} { mGraphicBufferAllocators{std::make_unique<GraphicBufferAllocators>()} { } } Codec2Client::Component::~Component() { Codec2Client::Component::~Component() { Loading @@ -1966,12 +2052,43 @@ c2_status_t Codec2Client::Component::createBlockPool( std::shared_ptr<Codec2Client::Configurable>* configurable) { std::shared_ptr<Codec2Client::Configurable>* configurable) { if (mAidlBase) { if (mAidlBase) { c2_aidl::IComponent::BlockPool aidlBlockPool; c2_aidl::IComponent::BlockPool aidlBlockPool; ::ndk::ScopedAStatus transStatus = mAidlBase->createBlockPool(static_cast<int32_t>(id), c2_status_t status = C2_OK; &aidlBlockPool); c2_status_t status = GetC2Status(transStatus, "createBlockPool"); // TODO: Temporary mapping for the current CCodecBufferChannel. // Handle this properly and remove this temporary allocator mapping. id = id == C2PlatformAllocatorStore::BUFFERQUEUE ? C2PlatformAllocatorStore::IGBA : id; if (id == C2PlatformAllocatorStore::IGBA) { std::shared_ptr<AidlGraphicBufferAllocator> gba = mGraphicBufferAllocators->create(); ::ndk::ScopedFileDescriptor waitableFd; ::ndk::ScopedAStatus ret = gba->getWaitableFd(&waitableFd); status = GetC2Status(ret, "Gba::getWaitableFd"); if (status != C2_OK) { if (status != C2_OK) { return status; return status; } } c2_aidl::IComponent::BlockPoolAllocator allocator; allocator.set<c2_aidl::IComponent::BlockPoolAllocator::allocator>(); allocator.get<c2_aidl::IComponent::BlockPoolAllocator::allocator>().igba = c2_aidl::IGraphicBufferAllocator::fromBinder(gba->asBinder()); allocator.get<c2_aidl::IComponent::BlockPoolAllocator::allocator>().waitableFd = std::move(waitableFd); ::ndk::ScopedAStatus transStatus = mAidlBase->createBlockPool( allocator, &aidlBlockPool); status = GetC2Status(transStatus, "createBlockPool"); if (status != C2_OK) { return status; } mGraphicBufferAllocators->setCurrentId(aidlBlockPool.blockPoolId); } else { ::ndk::ScopedAStatus transStatus = mAidlBase->createBlockPool( static_cast<int32_t>(id), &aidlBlockPool); status = GetC2Status(transStatus, "createBlockPool"); if (status != C2_OK) { return status; } } *blockPoolId = aidlBlockPool.blockPoolId; *blockPoolId = aidlBlockPool.blockPoolId; *configurable = std::make_shared<Configurable>(aidlBlockPool.configurable); *configurable = std::make_shared<Configurable>(aidlBlockPool.configurable); return C2_OK; return C2_OK; Loading Loading @@ -2003,6 +2120,7 @@ c2_status_t Codec2Client::Component::createBlockPool( c2_status_t Codec2Client::Component::destroyBlockPool( c2_status_t Codec2Client::Component::destroyBlockPool( C2BlockPool::local_id_t localId) { C2BlockPool::local_id_t localId) { if (mAidlBase) { if (mAidlBase) { mGraphicBufferAllocators->remove(localId); ::ndk::ScopedAStatus transStatus = mAidlBase->destroyBlockPool(localId); ::ndk::ScopedAStatus transStatus = mAidlBase->destroyBlockPool(localId); return GetC2Status(transStatus, "destroyBlockPool"); return GetC2Status(transStatus, "destroyBlockPool"); } } Loading @@ -2017,9 +2135,13 @@ c2_status_t Codec2Client::Component::destroyBlockPool( void Codec2Client::Component::handleOnWorkDone( void Codec2Client::Component::handleOnWorkDone( const std::list<std::unique_ptr<C2Work>> &workItems) { const std::list<std::unique_ptr<C2Work>> &workItems) { if (mAidlBase) { holdIgbaBlocks(workItems); } else { // Output bufferqueue-based blocks' lifetime management // Output bufferqueue-based blocks' lifetime management mOutputBufferQueue->holdBufferQueueBlocks(workItems); mOutputBufferQueue->holdBufferQueueBlocks(workItems); } } } c2_status_t Codec2Client::Component::queue( c2_status_t Codec2Client::Component::queue( std::list<std::unique_ptr<C2Work>>* const items) { std::list<std::unique_ptr<C2Work>>* const items) { Loading Loading @@ -2102,8 +2224,12 @@ c2_status_t Codec2Client::Component::flush( } } } } if (mAidlBase) { holdIgbaBlocks(*flushedWork); } else { // Output bufferqueue-based blocks' lifetime management // Output bufferqueue-based blocks' lifetime management mOutputBufferQueue->holdBufferQueueBlocks(*flushedWork); mOutputBufferQueue->holdBufferQueueBlocks(*flushedWork); } return status; return status; } } Loading Loading @@ -2242,6 +2368,17 @@ c2_status_t Codec2Client::Component::setOutputSurface( const sp<IGraphicBufferProducer>& surface, const sp<IGraphicBufferProducer>& surface, uint32_t generation, uint32_t generation, int maxDequeueCount) { int maxDequeueCount) { if (mAidlBase) { std::shared_ptr<AidlGraphicBufferAllocator> gba = mGraphicBufferAllocators->current(); if (!gba) { LOG(ERROR) << "setOutputSurface for AIDL -- " "GraphicBufferAllocator was not created."; return C2_CORRUPTED; } bool ret = gba->configure(surface, generation, maxDequeueCount); return ret ? C2_OK : C2_CORRUPTED; } uint64_t bqId = 0; uint64_t bqId = 0; sp<IGraphicBufferProducer> nullIgbp; sp<IGraphicBufferProducer> nullIgbp; sp<HGraphicBufferProducer2> nullHgbp; sp<HGraphicBufferProducer2> nullHgbp; Loading Loading @@ -2303,10 +2440,6 @@ c2_status_t Codec2Client::Component::setOutputSurface( ALOGD("setOutputSurface -- generation=%u consumer usage=%#llx%s", ALOGD("setOutputSurface -- generation=%u consumer usage=%#llx%s", generation, (long long)consumerUsage, syncObj ? " sync" : ""); generation, (long long)consumerUsage, syncObj ? " sync" : ""); if (mAidlBase) { // FIXME return C2_OMITTED; } Return<c2_hidl::Status> transStatus = syncObj ? Return<c2_hidl::Status> transStatus = syncObj ? mHidlBase1_2->setOutputSurfaceWithSyncObj( mHidlBase1_2->setOutputSurfaceWithSyncObj( static_cast<uint64_t>(blockPoolId), static_cast<uint64_t>(blockPoolId), Loading Loading @@ -2335,26 +2468,51 @@ status_t Codec2Client::Component::queueToOutputSurface( const QueueBufferInput& input, const QueueBufferInput& input, QueueBufferOutput* output) { QueueBufferOutput* output) { ScopedTrace trace(ATRACE_TAG,"Codec2Client::Component::queueToOutputSurface"); ScopedTrace trace(ATRACE_TAG,"Codec2Client::Component::queueToOutputSurface"); if (mAidlBase) { std::shared_ptr<AidlGraphicBufferAllocator> gba = mGraphicBufferAllocators->current(); if (gba) { return gba->displayBuffer(block, input, output); } else { return C2_NOT_FOUND; } } return mOutputBufferQueue->outputBuffer(block, input, output); return mOutputBufferQueue->outputBuffer(block, input, output); } } void Codec2Client::Component::pollForRenderedFrames(FrameEventHistoryDelta* delta) { void Codec2Client::Component::pollForRenderedFrames(FrameEventHistoryDelta* delta) { if (mAidlBase) { // TODO b/311348680 return; } mOutputBufferQueue->pollForRenderedFrames(delta); mOutputBufferQueue->pollForRenderedFrames(delta); } } void Codec2Client::Component::setOutputSurfaceMaxDequeueCount( void Codec2Client::Component::setOutputSurfaceMaxDequeueCount( int maxDequeueCount) { int maxDequeueCount) { if (mAidlBase) { std::shared_ptr<AidlGraphicBufferAllocator> gba = mGraphicBufferAllocators->current(); if (gba) { gba->updateMaxDequeueBufferCount(maxDequeueCount); } return; } mOutputBufferQueue->updateMaxDequeueBufferCount(maxDequeueCount); mOutputBufferQueue->updateMaxDequeueBufferCount(maxDequeueCount); } } void Codec2Client::Component::stopUsingOutputSurface( void Codec2Client::Component::stopUsingOutputSurface( C2BlockPool::local_id_t blockPoolId) { C2BlockPool::local_id_t blockPoolId) { std::scoped_lock lock(mOutputMutex); mOutputBufferQueue->stop(); if (mAidlBase) { if (mAidlBase) { // FIXME std::shared_ptr<AidlGraphicBufferAllocator> gba = mGraphicBufferAllocators->current(); if (gba) { gba->reset(); } return; return; } } std::scoped_lock lock(mOutputMutex); mOutputBufferQueue->stop(); Return<c2_hidl::Status> transStatus = mHidlBase1_0->setOutputSurface( Return<c2_hidl::Status> transStatus = mHidlBase1_0->setOutputSurface( static_cast<uint64_t>(blockPoolId), nullptr); static_cast<uint64_t>(blockPoolId), nullptr); if (!transStatus.isOk()) { if (!transStatus.isOk()) { Loading @@ -2372,9 +2530,50 @@ void Codec2Client::Component::stopUsingOutputSurface( void Codec2Client::Component::onBufferReleasedFromOutputSurface( void Codec2Client::Component::onBufferReleasedFromOutputSurface( uint32_t generation) { uint32_t generation) { if (mAidlBase) { std::shared_ptr<AidlGraphicBufferAllocator> gba = mGraphicBufferAllocators->current(); if (gba) { gba->onBufferReleased(generation); } return; } mOutputBufferQueue->onBufferReleased(generation); mOutputBufferQueue->onBufferReleased(generation); } } void Codec2Client::Component::holdIgbaBlocks( const std::list<std::unique_ptr<C2Work>>& workList) { if (!mAidlBase) { return; } std::shared_ptr<AidlGraphicBufferAllocator> gba = mGraphicBufferAllocators->current(); if (!gba) { return; } std::shared_ptr<c2_aidl::IGraphicBufferAllocator> igba = c2_aidl::IGraphicBufferAllocator::fromBinder(gba->asBinder()); for (const std::unique_ptr<C2Work>& work : workList) { if (!work) [[unlikely]] { continue; } for (const std::unique_ptr<C2Worklet>& worklet : work->worklets) { if (!worklet) { continue; } for (const std::shared_ptr<C2Buffer>& buffer : worklet->output.buffers) { if (buffer) { for (const C2ConstGraphicBlock& block : buffer->data().graphicBlocks()) { std::shared_ptr<_C2BlockPoolData> poolData = _C2BlockFactory::GetGraphicBlockPoolData(block); _C2BlockFactory::RegisterIgba(poolData, igba); } } } } } } c2_status_t Codec2Client::Component::connectToInputSurface( c2_status_t Codec2Client::Component::connectToInputSurface( const std::shared_ptr<InputSurface>& inputSurface, const std::shared_ptr<InputSurface>& inputSurface, std::shared_ptr<InputSurfaceConnection>* connection) { std::shared_ptr<InputSurfaceConnection>* connection) { Loading media/codec2/hal/client/include/codec2/hidl/client.h +11 −0 Original line number Original line Diff line number Diff line Loading @@ -478,6 +478,14 @@ struct Codec2Client::Component : public Codec2Client::Configurable { void onBufferReleasedFromOutputSurface( void onBufferReleasedFromOutputSurface( uint32_t generation); uint32_t generation); // When the client received \p workList and the blocks inside // \p workList are IGBA based graphic blocks, specify the owner // as the current IGBA for the future operations. // Future operations could be rendering the blocks to the surface // or deallocating blocks to the surface. void holdIgbaBlocks( const std::list<std::unique_ptr<C2Work>>& workList); // Connect to a given InputSurface. // Connect to a given InputSurface. c2_status_t connectToInputSurface( c2_status_t connectToInputSurface( const std::shared_ptr<InputSurface>& inputSurface, const std::shared_ptr<InputSurface>& inputSurface, Loading Loading @@ -517,6 +525,9 @@ protected: // In order to prevent the race condition mutex is added. // In order to prevent the race condition mutex is added. std::mutex mOutputMutex; std::mutex mOutputMutex; struct GraphicBufferAllocators; std::unique_ptr<GraphicBufferAllocators> mGraphicBufferAllocators; class AidlDeathManager; class AidlDeathManager; static AidlDeathManager *GetAidlDeathManager(); static AidlDeathManager *GetAidlDeathManager(); std::optional<size_t> mAidlDeathSeq; std::optional<size_t> mAidlDeathSeq; Loading media/codec2/hal/plugin/FilterWrapper.cpp +11 −2 Original line number Original line Diff line number Diff line Loading @@ -969,6 +969,15 @@ c2_status_t FilterWrapper::createBlockPool( C2PlatformAllocatorStore::id_t allocatorId, C2PlatformAllocatorStore::id_t allocatorId, std::shared_ptr<const C2Component> component, std::shared_ptr<const C2Component> component, std::shared_ptr<C2BlockPool> *pool) { std::shared_ptr<C2BlockPool> *pool) { C2PlatformAllocatorDesc allocatorParam; allocatorParam.allocatorId = allocatorId; return createBlockPool(allocatorParam, component, pool); } c2_status_t FilterWrapper::createBlockPool( C2PlatformAllocatorDesc &allocatorParam, std::shared_ptr<const C2Component> component, std::shared_ptr<C2BlockPool> *pool) { std::unique_lock lock(mWrappedComponentsMutex); std::unique_lock lock(mWrappedComponentsMutex); for (auto it = mWrappedComponents.begin(); it != mWrappedComponents.end(); ) { for (auto it = mWrappedComponents.begin(); it != mWrappedComponents.end(); ) { std::shared_ptr<const C2Component> comp = it->front().lock(); std::shared_ptr<const C2Component> comp = it->front().lock(); Loading @@ -983,13 +992,13 @@ c2_status_t FilterWrapper::createBlockPool( [](const std::weak_ptr<const C2Component> &el) { [](const std::weak_ptr<const C2Component> &el) { return el.lock(); return el.lock(); }); }); if (C2_OK == CreateCodec2BlockPool(allocatorId, components, pool)) { if (C2_OK == CreateCodec2BlockPool(allocatorParam, components, pool)) { return C2_OK; return C2_OK; } } } } ++it; ++it; } } return CreateCodec2BlockPool(allocatorId, component, pool); return CreateCodec2BlockPool(allocatorParam, component, pool); } } c2_status_t FilterWrapper::queryParamsForPreviousComponent( c2_status_t FilterWrapper::queryParamsForPreviousComponent( Loading media/codec2/hal/plugin/FilterWrapperStub.cpp +10 −1 Original line number Original line Diff line number Diff line Loading @@ -45,7 +45,16 @@ c2_status_t FilterWrapper::createBlockPool( C2PlatformAllocatorStore::id_t allocatorId, C2PlatformAllocatorStore::id_t allocatorId, std::shared_ptr<const C2Component> component, std::shared_ptr<const C2Component> component, std::shared_ptr<C2BlockPool> *pool) { std::shared_ptr<C2BlockPool> *pool) { return CreateCodec2BlockPool(allocatorId, component, pool); C2PlatformAllocatorDesc allocatorParam; allocatorParam.allocatorId = allocatorId; return createBlockPool(allocatorParam, component, pool); } c2_status_t FilterWrapper::createBlockPool( C2PlatformAllocatorDesc &allocatorParam, std::shared_ptr<const C2Component> component, std::shared_ptr<C2BlockPool> *pool) { return CreateCodec2BlockPool(allocatorParam, component, pool); } } } // namespace android } // namespace android Loading
media/codec2/hal/aidl/Component.cpp +30 −27 Original line number Original line Diff line number Diff line Loading @@ -294,47 +294,50 @@ ScopedAStatus Component::createBlockPool( static constexpr IComponent::BlockPoolAllocator::Tag IGBA = static constexpr IComponent::BlockPoolAllocator::Tag IGBA = IComponent::BlockPoolAllocator::allocator; IComponent::BlockPoolAllocator::allocator; c2_status_t status = C2_OK; c2_status_t status = C2_OK; ::android::C2PlatformAllocatorDesc allocatorParam; switch (allocator.getTag()) { switch (allocator.getTag()) { case ALLOCATOR_ID: case ALLOCATOR_ID: { allocatorParam.allocatorId = allocator.get<IComponent::BlockPoolAllocator::allocatorId>(); } break; case IGBA: { allocatorParam.allocatorId = ::android::C2PlatformAllocatorStore::IGBA; allocatorParam.igba = allocator.get<IComponent::BlockPoolAllocator::allocator>().igba; allocatorParam.waitableFd.reset( allocator.get<IComponent::BlockPoolAllocator::allocator>() .waitableFd.dup().release()); } break; default: return ScopedAStatus::fromServiceSpecificError(C2_CORRUPTED); } #ifdef __ANDROID_APEX__ #ifdef __ANDROID_APEX__ status = ::android::CreateCodec2BlockPool( status = ::android::CreateCodec2BlockPool( static_cast<::android::C2PlatformAllocatorStore::id_t>( allocatorParam, allocator.get<ALLOCATOR_ID>()), mComponent, mComponent, &c2BlockPool); &c2BlockPool); #else #else status = ComponentStore::GetFilterWrapper()->createBlockPool( status = ComponentStore::GetFilterWrapper()->createBlockPool( static_cast<::android::C2PlatformAllocatorStore::id_t>( allocatorParam, allocator.get<ALLOCATOR_ID>()), mComponent, mComponent, &c2BlockPool); &c2BlockPool); #endif #endif if (status != C2_OK) { if (status != C2_OK) { blockPool = nullptr; return ScopedAStatus::fromServiceSpecificError(status); } break; case IGBA: // FIXME break; default: break; } } if (blockPool) { { mBlockPoolsMutex.lock(); mBlockPoolsMutex.lock(); mBlockPools.emplace(c2BlockPool->getLocalId(), c2BlockPool); mBlockPools.emplace(c2BlockPool->getLocalId(), c2BlockPool); mBlockPoolsMutex.unlock(); mBlockPoolsMutex.unlock(); } else if (status == C2_OK) { status = C2_CORRUPTED; } } blockPool->blockPoolId = c2BlockPool ? c2BlockPool->getLocalId() : 0; blockPool->blockPoolId = c2BlockPool ? c2BlockPool->getLocalId() : 0; blockPool->configurable = SharedRefBase::make<CachedConfigurable>( blockPool->configurable = SharedRefBase::make<CachedConfigurable>( std::make_unique<BlockPoolIntf>(c2BlockPool)); std::make_unique<BlockPoolIntf>(c2BlockPool)); if (status == C2_OK) { return ScopedAStatus::ok(); return ScopedAStatus::ok(); } } return ScopedAStatus::fromServiceSpecificError(status); } ScopedAStatus Component::destroyBlockPool(int64_t blockPoolId) { ScopedAStatus Component::destroyBlockPool(int64_t blockPoolId) { std::lock_guard<std::mutex> lock(mBlockPoolsMutex); std::lock_guard<std::mutex> lock(mBlockPoolsMutex); Loading
media/codec2/hal/client/client.cpp +216 −17 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,8 @@ #define ATRACE_TAG ATRACE_TAG_VIDEO #define ATRACE_TAG ATRACE_TAG_VIDEO #include <android-base/logging.h> #include <android-base/logging.h> #include <utils/Trace.h> #include <utils/Trace.h> #include <codec2/aidl/GraphicBufferAllocator.h> #include <codec2/hidl/client.h> #include <codec2/hidl/client.h> #include <C2Debug.h> #include <C2Debug.h> #include <C2BufferPriv.h> #include <C2BufferPriv.h> Loading Loading @@ -74,6 +76,7 @@ #include <limits> #include <limits> #include <map> #include <map> #include <mutex> #include <mutex> #include <optional> #include <sstream> #include <sstream> #include <thread> #include <thread> #include <type_traits> #include <type_traits> Loading @@ -96,6 +99,9 @@ using H2BGraphicBufferProducer2 = ::android::hardware::graphics::bufferqueue:: V2_0::utils::H2BGraphicBufferProducer; V2_0::utils::H2BGraphicBufferProducer; using ::android::hardware::media::c2::V1_2::SurfaceSyncObj; using ::android::hardware::media::c2::V1_2::SurfaceSyncObj; using AidlGraphicBufferAllocator = ::aidl::android::hardware::media::c2:: implementation::GraphicBufferAllocator; namespace bufferpool2_aidl = ::aidl::android::hardware::media::bufferpool2; namespace bufferpool2_aidl = ::aidl::android::hardware::media::bufferpool2; namespace bufferpool_hidl = ::android::hardware::media::bufferpool::V2_0; namespace bufferpool_hidl = ::android::hardware::media::bufferpool::V2_0; namespace c2_aidl = ::aidl::android::hardware::media::c2; namespace c2_aidl = ::aidl::android::hardware::media::c2; Loading Loading @@ -1041,6 +1047,85 @@ struct Codec2Client::Component::OutputBufferQueue : } } }; }; // The class holds GraphicBufferAllocator and the associated id of // HAL side BlockPool. // This is tightly coupled with BlockPool creation and destruction. // The life cycle inside class will be as follows. // // On createBlockPool client request. // 1. this::create() creates a GraphicBufferAllocator and set it as // the current. // 2. C2AIDL_HAL::createBlockPool() creates a C2BlockPool using // the GraphicBufferAllocator created in #1. // 3. this::setCurrentId() associates the id returned in #2 to the current // // On destroyBlockPool cliet request // 1. C2AIDL_HAL::destroyBlockPool() destroys the block pool // from HAL process. // 2. this::remove() destroys GraphicBufferAllocator which is associatted // with the C2BlockPool in #1. // struct Codec2Client::Component::GraphicBufferAllocators { private: std::optional<C2BlockPool::local_id_t> mCurrentId; std::shared_ptr<AidlGraphicBufferAllocator> mCurrent; // A new BlockPool is created before the old BlockPool is destroyed. // This holds the reference of the old BlockPool when a new BlockPool is // created until the old BlockPool is explicitly requested for destruction. std::map<C2BlockPool::local_id_t, std::shared_ptr<AidlGraphicBufferAllocator>> mOlds; std::mutex mMutex; public: // Creates a GraphicBufferAllocator which will be passed to HAL // for creating C2BlockPool. And the created GraphicBufferAllocator // will be used afterwards by current(). std::shared_ptr<AidlGraphicBufferAllocator> create() { std::unique_lock<std::mutex> l(mMutex); if (mCurrent) { // If this is not stopped. mCurrent->reset(); if (mCurrentId.has_value()) { mOlds.emplace(mCurrentId.value(), mCurrent); } mCurrentId.reset(); mCurrent.reset(); } // TODO: integrate initial value with CCodec/CCodecBufferChannel mCurrent = AidlGraphicBufferAllocator::CreateGraphicBufferAllocator(3 /* maxDequeueCount */); ALOGD("GraphicBufferAllocator created"); return mCurrent; } // Associates the blockpool Id returned from HAL to the // current GraphicBufferAllocator. void setCurrentId(C2BlockPool::local_id_t id) { std::unique_lock<std::mutex> l(mMutex); CHECK(!mCurrentId.has_value()); mCurrentId = id; } // Returns the current GraphicBufferAllocator. std::shared_ptr<AidlGraphicBufferAllocator> current() { std::unique_lock<std::mutex> l(mMutex); return mCurrent; } // Removes the GraphicBufferAllocator associated with given \p id. void remove(C2BlockPool::local_id_t id) { std::unique_lock<std::mutex> l(mMutex); mOlds.erase(id); if (mCurrentId == id) { if (mCurrent) { mCurrent->reset(); mCurrent.reset(); } mCurrentId.reset(); } } }; // Codec2Client // Codec2Client Codec2Client::Codec2Client(sp<HidlBase> const& base, Codec2Client::Codec2Client(sp<HidlBase> const& base, sp<c2_hidl::IConfigurable> const& configurable, sp<c2_hidl::IConfigurable> const& configurable, Loading Loading @@ -1125,6 +1210,7 @@ c2_status_t Codec2Client::createComponent( << status << "."; << status << "."; } } (*component)->mAidlBufferPoolSender->setReceiver(mAidlHostPoolManager); (*component)->mAidlBufferPoolSender->setReceiver(mAidlHostPoolManager); aidlListener->component = *component; return status; return status; } } Loading Loading @@ -1951,7 +2037,7 @@ Codec2Client::Component::Component(const std::shared_ptr<AidlBase> &base) }, }, mAidlBase{base}, mAidlBase{base}, mAidlBufferPoolSender{std::make_unique<AidlBufferPoolSender>()}, mAidlBufferPoolSender{std::make_unique<AidlBufferPoolSender>()}, mOutputBufferQueue{std::make_unique<OutputBufferQueue>()} { mGraphicBufferAllocators{std::make_unique<GraphicBufferAllocators>()} { } } Codec2Client::Component::~Component() { Codec2Client::Component::~Component() { Loading @@ -1966,12 +2052,43 @@ c2_status_t Codec2Client::Component::createBlockPool( std::shared_ptr<Codec2Client::Configurable>* configurable) { std::shared_ptr<Codec2Client::Configurable>* configurable) { if (mAidlBase) { if (mAidlBase) { c2_aidl::IComponent::BlockPool aidlBlockPool; c2_aidl::IComponent::BlockPool aidlBlockPool; ::ndk::ScopedAStatus transStatus = mAidlBase->createBlockPool(static_cast<int32_t>(id), c2_status_t status = C2_OK; &aidlBlockPool); c2_status_t status = GetC2Status(transStatus, "createBlockPool"); // TODO: Temporary mapping for the current CCodecBufferChannel. // Handle this properly and remove this temporary allocator mapping. id = id == C2PlatformAllocatorStore::BUFFERQUEUE ? C2PlatformAllocatorStore::IGBA : id; if (id == C2PlatformAllocatorStore::IGBA) { std::shared_ptr<AidlGraphicBufferAllocator> gba = mGraphicBufferAllocators->create(); ::ndk::ScopedFileDescriptor waitableFd; ::ndk::ScopedAStatus ret = gba->getWaitableFd(&waitableFd); status = GetC2Status(ret, "Gba::getWaitableFd"); if (status != C2_OK) { if (status != C2_OK) { return status; return status; } } c2_aidl::IComponent::BlockPoolAllocator allocator; allocator.set<c2_aidl::IComponent::BlockPoolAllocator::allocator>(); allocator.get<c2_aidl::IComponent::BlockPoolAllocator::allocator>().igba = c2_aidl::IGraphicBufferAllocator::fromBinder(gba->asBinder()); allocator.get<c2_aidl::IComponent::BlockPoolAllocator::allocator>().waitableFd = std::move(waitableFd); ::ndk::ScopedAStatus transStatus = mAidlBase->createBlockPool( allocator, &aidlBlockPool); status = GetC2Status(transStatus, "createBlockPool"); if (status != C2_OK) { return status; } mGraphicBufferAllocators->setCurrentId(aidlBlockPool.blockPoolId); } else { ::ndk::ScopedAStatus transStatus = mAidlBase->createBlockPool( static_cast<int32_t>(id), &aidlBlockPool); status = GetC2Status(transStatus, "createBlockPool"); if (status != C2_OK) { return status; } } *blockPoolId = aidlBlockPool.blockPoolId; *blockPoolId = aidlBlockPool.blockPoolId; *configurable = std::make_shared<Configurable>(aidlBlockPool.configurable); *configurable = std::make_shared<Configurable>(aidlBlockPool.configurable); return C2_OK; return C2_OK; Loading Loading @@ -2003,6 +2120,7 @@ c2_status_t Codec2Client::Component::createBlockPool( c2_status_t Codec2Client::Component::destroyBlockPool( c2_status_t Codec2Client::Component::destroyBlockPool( C2BlockPool::local_id_t localId) { C2BlockPool::local_id_t localId) { if (mAidlBase) { if (mAidlBase) { mGraphicBufferAllocators->remove(localId); ::ndk::ScopedAStatus transStatus = mAidlBase->destroyBlockPool(localId); ::ndk::ScopedAStatus transStatus = mAidlBase->destroyBlockPool(localId); return GetC2Status(transStatus, "destroyBlockPool"); return GetC2Status(transStatus, "destroyBlockPool"); } } Loading @@ -2017,9 +2135,13 @@ c2_status_t Codec2Client::Component::destroyBlockPool( void Codec2Client::Component::handleOnWorkDone( void Codec2Client::Component::handleOnWorkDone( const std::list<std::unique_ptr<C2Work>> &workItems) { const std::list<std::unique_ptr<C2Work>> &workItems) { if (mAidlBase) { holdIgbaBlocks(workItems); } else { // Output bufferqueue-based blocks' lifetime management // Output bufferqueue-based blocks' lifetime management mOutputBufferQueue->holdBufferQueueBlocks(workItems); mOutputBufferQueue->holdBufferQueueBlocks(workItems); } } } c2_status_t Codec2Client::Component::queue( c2_status_t Codec2Client::Component::queue( std::list<std::unique_ptr<C2Work>>* const items) { std::list<std::unique_ptr<C2Work>>* const items) { Loading Loading @@ -2102,8 +2224,12 @@ c2_status_t Codec2Client::Component::flush( } } } } if (mAidlBase) { holdIgbaBlocks(*flushedWork); } else { // Output bufferqueue-based blocks' lifetime management // Output bufferqueue-based blocks' lifetime management mOutputBufferQueue->holdBufferQueueBlocks(*flushedWork); mOutputBufferQueue->holdBufferQueueBlocks(*flushedWork); } return status; return status; } } Loading Loading @@ -2242,6 +2368,17 @@ c2_status_t Codec2Client::Component::setOutputSurface( const sp<IGraphicBufferProducer>& surface, const sp<IGraphicBufferProducer>& surface, uint32_t generation, uint32_t generation, int maxDequeueCount) { int maxDequeueCount) { if (mAidlBase) { std::shared_ptr<AidlGraphicBufferAllocator> gba = mGraphicBufferAllocators->current(); if (!gba) { LOG(ERROR) << "setOutputSurface for AIDL -- " "GraphicBufferAllocator was not created."; return C2_CORRUPTED; } bool ret = gba->configure(surface, generation, maxDequeueCount); return ret ? C2_OK : C2_CORRUPTED; } uint64_t bqId = 0; uint64_t bqId = 0; sp<IGraphicBufferProducer> nullIgbp; sp<IGraphicBufferProducer> nullIgbp; sp<HGraphicBufferProducer2> nullHgbp; sp<HGraphicBufferProducer2> nullHgbp; Loading Loading @@ -2303,10 +2440,6 @@ c2_status_t Codec2Client::Component::setOutputSurface( ALOGD("setOutputSurface -- generation=%u consumer usage=%#llx%s", ALOGD("setOutputSurface -- generation=%u consumer usage=%#llx%s", generation, (long long)consumerUsage, syncObj ? " sync" : ""); generation, (long long)consumerUsage, syncObj ? " sync" : ""); if (mAidlBase) { // FIXME return C2_OMITTED; } Return<c2_hidl::Status> transStatus = syncObj ? Return<c2_hidl::Status> transStatus = syncObj ? mHidlBase1_2->setOutputSurfaceWithSyncObj( mHidlBase1_2->setOutputSurfaceWithSyncObj( static_cast<uint64_t>(blockPoolId), static_cast<uint64_t>(blockPoolId), Loading Loading @@ -2335,26 +2468,51 @@ status_t Codec2Client::Component::queueToOutputSurface( const QueueBufferInput& input, const QueueBufferInput& input, QueueBufferOutput* output) { QueueBufferOutput* output) { ScopedTrace trace(ATRACE_TAG,"Codec2Client::Component::queueToOutputSurface"); ScopedTrace trace(ATRACE_TAG,"Codec2Client::Component::queueToOutputSurface"); if (mAidlBase) { std::shared_ptr<AidlGraphicBufferAllocator> gba = mGraphicBufferAllocators->current(); if (gba) { return gba->displayBuffer(block, input, output); } else { return C2_NOT_FOUND; } } return mOutputBufferQueue->outputBuffer(block, input, output); return mOutputBufferQueue->outputBuffer(block, input, output); } } void Codec2Client::Component::pollForRenderedFrames(FrameEventHistoryDelta* delta) { void Codec2Client::Component::pollForRenderedFrames(FrameEventHistoryDelta* delta) { if (mAidlBase) { // TODO b/311348680 return; } mOutputBufferQueue->pollForRenderedFrames(delta); mOutputBufferQueue->pollForRenderedFrames(delta); } } void Codec2Client::Component::setOutputSurfaceMaxDequeueCount( void Codec2Client::Component::setOutputSurfaceMaxDequeueCount( int maxDequeueCount) { int maxDequeueCount) { if (mAidlBase) { std::shared_ptr<AidlGraphicBufferAllocator> gba = mGraphicBufferAllocators->current(); if (gba) { gba->updateMaxDequeueBufferCount(maxDequeueCount); } return; } mOutputBufferQueue->updateMaxDequeueBufferCount(maxDequeueCount); mOutputBufferQueue->updateMaxDequeueBufferCount(maxDequeueCount); } } void Codec2Client::Component::stopUsingOutputSurface( void Codec2Client::Component::stopUsingOutputSurface( C2BlockPool::local_id_t blockPoolId) { C2BlockPool::local_id_t blockPoolId) { std::scoped_lock lock(mOutputMutex); mOutputBufferQueue->stop(); if (mAidlBase) { if (mAidlBase) { // FIXME std::shared_ptr<AidlGraphicBufferAllocator> gba = mGraphicBufferAllocators->current(); if (gba) { gba->reset(); } return; return; } } std::scoped_lock lock(mOutputMutex); mOutputBufferQueue->stop(); Return<c2_hidl::Status> transStatus = mHidlBase1_0->setOutputSurface( Return<c2_hidl::Status> transStatus = mHidlBase1_0->setOutputSurface( static_cast<uint64_t>(blockPoolId), nullptr); static_cast<uint64_t>(blockPoolId), nullptr); if (!transStatus.isOk()) { if (!transStatus.isOk()) { Loading @@ -2372,9 +2530,50 @@ void Codec2Client::Component::stopUsingOutputSurface( void Codec2Client::Component::onBufferReleasedFromOutputSurface( void Codec2Client::Component::onBufferReleasedFromOutputSurface( uint32_t generation) { uint32_t generation) { if (mAidlBase) { std::shared_ptr<AidlGraphicBufferAllocator> gba = mGraphicBufferAllocators->current(); if (gba) { gba->onBufferReleased(generation); } return; } mOutputBufferQueue->onBufferReleased(generation); mOutputBufferQueue->onBufferReleased(generation); } } void Codec2Client::Component::holdIgbaBlocks( const std::list<std::unique_ptr<C2Work>>& workList) { if (!mAidlBase) { return; } std::shared_ptr<AidlGraphicBufferAllocator> gba = mGraphicBufferAllocators->current(); if (!gba) { return; } std::shared_ptr<c2_aidl::IGraphicBufferAllocator> igba = c2_aidl::IGraphicBufferAllocator::fromBinder(gba->asBinder()); for (const std::unique_ptr<C2Work>& work : workList) { if (!work) [[unlikely]] { continue; } for (const std::unique_ptr<C2Worklet>& worklet : work->worklets) { if (!worklet) { continue; } for (const std::shared_ptr<C2Buffer>& buffer : worklet->output.buffers) { if (buffer) { for (const C2ConstGraphicBlock& block : buffer->data().graphicBlocks()) { std::shared_ptr<_C2BlockPoolData> poolData = _C2BlockFactory::GetGraphicBlockPoolData(block); _C2BlockFactory::RegisterIgba(poolData, igba); } } } } } } c2_status_t Codec2Client::Component::connectToInputSurface( c2_status_t Codec2Client::Component::connectToInputSurface( const std::shared_ptr<InputSurface>& inputSurface, const std::shared_ptr<InputSurface>& inputSurface, std::shared_ptr<InputSurfaceConnection>* connection) { std::shared_ptr<InputSurfaceConnection>* connection) { Loading
media/codec2/hal/client/include/codec2/hidl/client.h +11 −0 Original line number Original line Diff line number Diff line Loading @@ -478,6 +478,14 @@ struct Codec2Client::Component : public Codec2Client::Configurable { void onBufferReleasedFromOutputSurface( void onBufferReleasedFromOutputSurface( uint32_t generation); uint32_t generation); // When the client received \p workList and the blocks inside // \p workList are IGBA based graphic blocks, specify the owner // as the current IGBA for the future operations. // Future operations could be rendering the blocks to the surface // or deallocating blocks to the surface. void holdIgbaBlocks( const std::list<std::unique_ptr<C2Work>>& workList); // Connect to a given InputSurface. // Connect to a given InputSurface. c2_status_t connectToInputSurface( c2_status_t connectToInputSurface( const std::shared_ptr<InputSurface>& inputSurface, const std::shared_ptr<InputSurface>& inputSurface, Loading Loading @@ -517,6 +525,9 @@ protected: // In order to prevent the race condition mutex is added. // In order to prevent the race condition mutex is added. std::mutex mOutputMutex; std::mutex mOutputMutex; struct GraphicBufferAllocators; std::unique_ptr<GraphicBufferAllocators> mGraphicBufferAllocators; class AidlDeathManager; class AidlDeathManager; static AidlDeathManager *GetAidlDeathManager(); static AidlDeathManager *GetAidlDeathManager(); std::optional<size_t> mAidlDeathSeq; std::optional<size_t> mAidlDeathSeq; Loading
media/codec2/hal/plugin/FilterWrapper.cpp +11 −2 Original line number Original line Diff line number Diff line Loading @@ -969,6 +969,15 @@ c2_status_t FilterWrapper::createBlockPool( C2PlatformAllocatorStore::id_t allocatorId, C2PlatformAllocatorStore::id_t allocatorId, std::shared_ptr<const C2Component> component, std::shared_ptr<const C2Component> component, std::shared_ptr<C2BlockPool> *pool) { std::shared_ptr<C2BlockPool> *pool) { C2PlatformAllocatorDesc allocatorParam; allocatorParam.allocatorId = allocatorId; return createBlockPool(allocatorParam, component, pool); } c2_status_t FilterWrapper::createBlockPool( C2PlatformAllocatorDesc &allocatorParam, std::shared_ptr<const C2Component> component, std::shared_ptr<C2BlockPool> *pool) { std::unique_lock lock(mWrappedComponentsMutex); std::unique_lock lock(mWrappedComponentsMutex); for (auto it = mWrappedComponents.begin(); it != mWrappedComponents.end(); ) { for (auto it = mWrappedComponents.begin(); it != mWrappedComponents.end(); ) { std::shared_ptr<const C2Component> comp = it->front().lock(); std::shared_ptr<const C2Component> comp = it->front().lock(); Loading @@ -983,13 +992,13 @@ c2_status_t FilterWrapper::createBlockPool( [](const std::weak_ptr<const C2Component> &el) { [](const std::weak_ptr<const C2Component> &el) { return el.lock(); return el.lock(); }); }); if (C2_OK == CreateCodec2BlockPool(allocatorId, components, pool)) { if (C2_OK == CreateCodec2BlockPool(allocatorParam, components, pool)) { return C2_OK; return C2_OK; } } } } ++it; ++it; } } return CreateCodec2BlockPool(allocatorId, component, pool); return CreateCodec2BlockPool(allocatorParam, component, pool); } } c2_status_t FilterWrapper::queryParamsForPreviousComponent( c2_status_t FilterWrapper::queryParamsForPreviousComponent( Loading
media/codec2/hal/plugin/FilterWrapperStub.cpp +10 −1 Original line number Original line Diff line number Diff line Loading @@ -45,7 +45,16 @@ c2_status_t FilterWrapper::createBlockPool( C2PlatformAllocatorStore::id_t allocatorId, C2PlatformAllocatorStore::id_t allocatorId, std::shared_ptr<const C2Component> component, std::shared_ptr<const C2Component> component, std::shared_ptr<C2BlockPool> *pool) { std::shared_ptr<C2BlockPool> *pool) { return CreateCodec2BlockPool(allocatorId, component, pool); C2PlatformAllocatorDesc allocatorParam; allocatorParam.allocatorId = allocatorId; return createBlockPool(allocatorParam, component, pool); } c2_status_t FilterWrapper::createBlockPool( C2PlatformAllocatorDesc &allocatorParam, std::shared_ptr<const C2Component> component, std::shared_ptr<C2BlockPool> *pool) { return CreateCodec2BlockPool(allocatorParam, component, pool); } } } // namespace android } // namespace android