media.c2 aidl: connect CCodec, Codec2Client and HAL
Test: m
Bug: 254050314
Change-Id: I63640f14416f8c3c3c4e1eb52ab85ae6bb04d421
diff --git a/media/codec2/hal/aidl/Component.cpp b/media/codec2/hal/aidl/Component.cpp
index 4f5b899..4605af3 100644
--- a/media/codec2/hal/aidl/Component.cpp
+++ b/media/codec2/hal/aidl/Component.cpp
@@ -294,46 +294,49 @@
static constexpr IComponent::BlockPoolAllocator::Tag IGBA =
IComponent::BlockPoolAllocator::allocator;
c2_status_t status = C2_OK;
+ ::android::C2PlatformAllocatorDesc allocatorParam;
switch (allocator.getTag()) {
- case ALLOCATOR_ID:
-#ifdef __ANDROID_APEX__
- status = ::android::CreateCodec2BlockPool(
- static_cast<::android::C2PlatformAllocatorStore::id_t>(
- allocator.get<ALLOCATOR_ID>()),
- mComponent,
- &c2BlockPool);
-#else
- status = ComponentStore::GetFilterWrapper()->createBlockPool(
- static_cast<::android::C2PlatformAllocatorStore::id_t>(
- allocator.get<ALLOCATOR_ID>()),
- mComponent,
- &c2BlockPool);
-#endif
- if (status != C2_OK) {
- blockPool = nullptr;
- }
- break;
- case IGBA:
- // FIXME
- break;
+ 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:
- break;
+ return ScopedAStatus::fromServiceSpecificError(C2_CORRUPTED);
}
- if (blockPool) {
+#ifdef __ANDROID_APEX__
+ status = ::android::CreateCodec2BlockPool(
+ allocatorParam,
+ mComponent,
+ &c2BlockPool);
+#else
+ status = ComponentStore::GetFilterWrapper()->createBlockPool(
+ allocatorParam,
+ mComponent,
+ &c2BlockPool);
+#endif
+ if (status != C2_OK) {
+ return ScopedAStatus::fromServiceSpecificError(status);
+ }
+ {
mBlockPoolsMutex.lock();
mBlockPools.emplace(c2BlockPool->getLocalId(), c2BlockPool);
mBlockPoolsMutex.unlock();
- } else if (status == C2_OK) {
- status = C2_CORRUPTED;
}
blockPool->blockPoolId = c2BlockPool ? c2BlockPool->getLocalId() : 0;
blockPool->configurable = SharedRefBase::make<CachedConfigurable>(
std::make_unique<BlockPoolIntf>(c2BlockPool));
- if (status == C2_OK) {
- return ScopedAStatus::ok();
- }
- return ScopedAStatus::fromServiceSpecificError(status);
+ return ScopedAStatus::ok();
}
ScopedAStatus Component::destroyBlockPool(int64_t blockPoolId) {