Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d59d43a authored by Arun Johnson's avatar Arun Johnson
Browse files

C2BlockPool created with CreateCodec2BlockPool

block pool created changed from C2PooledBlockPool
to CretateCodec2BlockPool so that it works with
aidl/hidl with no additional checks

Bug: 325512893
Change-Id: I015538996787d7dcedf5a426aa43deafa4828e85
parent bb5fe023
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -487,7 +487,19 @@ void Component::initListener(const std::shared_ptr<Component>& self) {
    if (__builtin_available(android __ANDROID_API_T__, *)) {
        std::shared_ptr<C2Component::Listener> c2listener;
        if (mMultiAccessUnitIntf) {
            mMultiAccessUnitHelper = std::make_shared<MultiAccessUnitHelper>(mMultiAccessUnitIntf);
            std::shared_ptr<C2Allocator> allocator;
            std::shared_ptr<C2BlockPool> linearPool;
            std::shared_ptr<C2AllocatorStore> store = ::android::GetCodec2PlatformAllocatorStore();
            if(store->fetchAllocator(C2AllocatorStore::DEFAULT_LINEAR, &allocator) == C2_OK) {
                ::android::C2PlatformAllocatorDesc desc;
                desc.allocatorId = allocator->getId();
                if (C2_OK == CreateCodec2BlockPool(desc, mComponent, &linearPool)) {
                    if (linearPool) {
                        mMultiAccessUnitHelper = std::make_shared<MultiAccessUnitHelper>(
                                mMultiAccessUnitIntf, linearPool);
                    }
                }
            }
        }
        c2listener = mMultiAccessUnitHelper ?
                std::make_shared<MultiAccessUnitListener>(self, mMultiAccessUnitHelper) :
+5 −5
Original line number Diff line number Diff line
@@ -126,12 +126,12 @@ class C2MultiAccessUnitBuffer : public C2Buffer {

//MultiAccessUnitHelper
MultiAccessUnitHelper::MultiAccessUnitHelper(
        const std::shared_ptr<MultiAccessUnitInterface>& intf):
        const std::shared_ptr<MultiAccessUnitInterface>& intf,
        std::shared_ptr<C2BlockPool>& linearPool):
        mInit(false),
        mInterface(intf) {
    std::shared_ptr<C2AllocatorStore> store = GetCodec2PlatformAllocatorStore();
    if(store->fetchAllocator(C2AllocatorStore::DEFAULT_LINEAR, &mLinearAllocator) == C2_OK) {
        mLinearPool = std::make_shared<C2PooledBlockPool>(mLinearAllocator, ++mBlockPoolId);
        mInterface(intf),
        mLinearPool(linearPool) {
    if (mLinearPool) {
        mInit = true;
    }
}
+2 −3
Original line number Diff line number Diff line
@@ -58,7 +58,8 @@ protected:
struct MultiAccessUnitHelper {
public:
    MultiAccessUnitHelper(
            const std::shared_ptr<MultiAccessUnitInterface>& intf);
            const std::shared_ptr<MultiAccessUnitInterface>& intf,
            std::shared_ptr<C2BlockPool> &linearPool);

    virtual ~MultiAccessUnitHelper();

@@ -202,8 +203,6 @@ protected:
    C2BlockPool::local_id_t mBlockPoolId;
    // C2Blockpool for output buffer allocation
    std::shared_ptr<C2BlockPool> mLinearPool;
    // Allocator for output buffer allocation
    std::shared_ptr<C2Allocator> mLinearAllocator;
    // FrameIndex for the current outgoing work
    std::atomic_uint64_t mFrameIndex;
    // Mutex to protect mFrameHolder
+13 −1
Original line number Diff line number Diff line
@@ -570,7 +570,19 @@ std::shared_ptr<C2Component> Component::findLocalComponent(
void Component::initListener(const sp<Component>& self) {
    std::shared_ptr<C2Component::Listener> c2listener;
    if (mMultiAccessUnitIntf) {
        mMultiAccessUnitHelper = std::make_shared<MultiAccessUnitHelper>(mMultiAccessUnitIntf);
        std::shared_ptr<C2Allocator> allocator;
        std::shared_ptr<C2BlockPool> linearPool;
        std::shared_ptr<C2AllocatorStore> store = ::android::GetCodec2PlatformAllocatorStore();
        if(store->fetchAllocator(C2AllocatorStore::DEFAULT_LINEAR, &allocator) == C2_OK) {
            ::android::C2PlatformAllocatorDesc desc;
            desc.allocatorId = allocator->getId();
            if (C2_OK == CreateCodec2BlockPool(desc, mComponent, &linearPool)) {
                if (linearPool) {
                    mMultiAccessUnitHelper = std::make_shared<MultiAccessUnitHelper>(
                            mMultiAccessUnitIntf, linearPool);
                }
            }
        }
    }
    c2listener = mMultiAccessUnitHelper ?
            std::make_shared<MultiAccessUnitListener>(self, mMultiAccessUnitHelper) :
+13 −1
Original line number Diff line number Diff line
@@ -583,7 +583,19 @@ std::shared_ptr<C2Component> Component::findLocalComponent(
void Component::initListener(const sp<Component>& self) {
    std::shared_ptr<C2Component::Listener> c2listener;
    if (mMultiAccessUnitIntf) {
        mMultiAccessUnitHelper = std::make_shared<MultiAccessUnitHelper>(mMultiAccessUnitIntf);
        std::shared_ptr<C2Allocator> allocator;
        std::shared_ptr<C2BlockPool> linearPool;
        std::shared_ptr<C2AllocatorStore> store = ::android::GetCodec2PlatformAllocatorStore();
        if(store->fetchAllocator(C2AllocatorStore::DEFAULT_LINEAR, &allocator) == C2_OK) {
            ::android::C2PlatformAllocatorDesc desc;
            desc.allocatorId = allocator->getId();
            if (C2_OK == CreateCodec2BlockPool(desc, mComponent, &linearPool)) {
                if (linearPool) {
                    mMultiAccessUnitHelper = std::make_shared<MultiAccessUnitHelper>(
                            mMultiAccessUnitIntf, linearPool);
                }
            }
        }
    }
    c2listener = mMultiAccessUnitHelper ?
            std::make_shared<MultiAccessUnitListener>(self, mMultiAccessUnitHelper) :
Loading