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

Commit 5ad4e87f authored by Sungtak Lee's avatar Sungtak Lee Committed by Automerger Merge Worker
Browse files

Merge "media.c2 aidl: Apply bufferpool based allocator interface change" into main am: 6a18f495

parents 7748dac9 6a18f495
Loading
Loading
Loading
Loading
+9 −17
Original line number Original line Diff line number Diff line
@@ -289,30 +289,22 @@ ScopedAStatus Component::createBlockPool(
        const IComponent::BlockPoolAllocator &allocator,
        const IComponent::BlockPoolAllocator &allocator,
        IComponent::BlockPool *blockPool) {
        IComponent::BlockPool *blockPool) {
    std::shared_ptr<C2BlockPool> c2BlockPool;
    std::shared_ptr<C2BlockPool> c2BlockPool;
    static constexpr IComponent::BlockPoolAllocator::Tag ALLOCATOR_ID =
        IComponent::BlockPoolAllocator::allocatorId;
    static constexpr IComponent::BlockPoolAllocator::Tag IGBA =
        IComponent::BlockPoolAllocator::allocator;
    c2_status_t status = C2_OK;
    c2_status_t status = C2_OK;
    ::android::C2PlatformAllocatorDesc allocatorParam;
    ::android::C2PlatformAllocatorDesc allocatorParam;
    switch (allocator.getTag()) {
    allocatorParam.allocatorId = allocator.allocatorId;
        case ALLOCATOR_ID: {
    switch (allocator.allocatorId) {
            allocatorParam.allocatorId =
        case ::android::C2PlatformAllocatorStore::IGBA: {
                    allocator.get<IComponent::BlockPoolAllocator::allocatorId>();
            allocatorParam.igba = allocator.gbAllocator->igba;
            allocatorParam.waitableFd.reset(
                    allocator.gbAllocator->waitableFd.dup().release());
        }
        }
        break;
        break;
        case IGBA: {
        default: {
            allocatorParam.allocatorId = ::android::C2PlatformAllocatorStore::IGBA;
            // no-op
            allocatorParam.igba =
                    allocator.get<IComponent::BlockPoolAllocator::allocator>().igba;
            allocatorParam.waitableFd.reset(
                    allocator.get<IComponent::BlockPoolAllocator::allocator>()
                    .waitableFd.dup().release());
        }
        }
        break;
        break;
        default:
            return ScopedAStatus::fromServiceSpecificError(C2_CORRUPTED);
    }
    }

#ifdef __ANDROID_APEX__
#ifdef __ANDROID_APEX__
    status = ::android::CreateCodec2BlockPool(
    status = ::android::CreateCodec2BlockPool(
            allocatorParam,
            allocatorParam,
+7 −6
Original line number Original line Diff line number Diff line
@@ -2072,6 +2072,8 @@ c2_status_t Codec2Client::Component::createBlockPool(
        id = id == C2PlatformAllocatorStore::BUFFERQUEUE ?
        id = id == C2PlatformAllocatorStore::BUFFERQUEUE ?
                C2PlatformAllocatorStore::IGBA : id;
                C2PlatformAllocatorStore::IGBA : id;


        c2_aidl::IComponent::BlockPoolAllocator allocator;
        allocator.allocatorId = id;
        if (id == C2PlatformAllocatorStore::IGBA)  {
        if (id == C2PlatformAllocatorStore::IGBA)  {
            std::shared_ptr<AidlGraphicBufferAllocator> gba =
            std::shared_ptr<AidlGraphicBufferAllocator> gba =
                    mGraphicBufferAllocators->create();
                    mGraphicBufferAllocators->create();
@@ -2081,12 +2083,11 @@ c2_status_t Codec2Client::Component::createBlockPool(
            if (status != C2_OK) {
            if (status != C2_OK) {
                return status;
                return status;
            }
            }
            c2_aidl::IComponent::BlockPoolAllocator allocator;
            c2_aidl::IComponent::GbAllocator gbAllocator;
            allocator.set<c2_aidl::IComponent::BlockPoolAllocator::allocator>();
            gbAllocator.waitableFd = std::move(waitableFd);
            allocator.get<c2_aidl::IComponent::BlockPoolAllocator::allocator>().igba =
            gbAllocator.igba =
                    c2_aidl::IGraphicBufferAllocator::fromBinder(gba->asBinder());
                    c2_aidl::IGraphicBufferAllocator::fromBinder(gba->asBinder());
            allocator.get<c2_aidl::IComponent::BlockPoolAllocator::allocator>().waitableFd =
            allocator.gbAllocator = std::move(gbAllocator);
                    std::move(waitableFd);
            ::ndk::ScopedAStatus transStatus = mAidlBase->createBlockPool(
            ::ndk::ScopedAStatus transStatus = mAidlBase->createBlockPool(
                    allocator, &aidlBlockPool);
                    allocator, &aidlBlockPool);
            status = GetC2Status(transStatus, "createBlockPool");
            status = GetC2Status(transStatus, "createBlockPool");
@@ -2096,7 +2097,7 @@ c2_status_t Codec2Client::Component::createBlockPool(
            mGraphicBufferAllocators->setCurrentId(aidlBlockPool.blockPoolId);
            mGraphicBufferAllocators->setCurrentId(aidlBlockPool.blockPoolId);
        } else {
        } else {
            ::ndk::ScopedAStatus transStatus = mAidlBase->createBlockPool(
            ::ndk::ScopedAStatus transStatus = mAidlBase->createBlockPool(
                    static_cast<int32_t>(id), &aidlBlockPool);
                    allocator, &aidlBlockPool);
            status = GetC2Status(transStatus, "createBlockPool");
            status = GetC2Status(transStatus, "createBlockPool");
            if (status != C2_OK) {
            if (status != C2_OK) {
                return status;
                return status;