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

Commit 27fe43ec authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "CCodec: read usage from component and apply to input buffers"

parents 2c267b77 666604a9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -967,6 +967,7 @@ void CCodec::configure(const sp<AMessage> &msg) {
                C2AndroidMemoryUsage androidUsage(C2MemoryUsage(usage.value));
                config->mISConfig->mUsage = androidUsage.asGrallocUsage();
            }
            config->mInputFormat->setInt64("android._C2MemoryUsage", usage.value);
        }

        // NOTE: we don't blindly use client specified input size if specified as clients
+6 −4
Original line number Diff line number Diff line
@@ -807,8 +807,9 @@ sp<Codec2Buffer> LinearInputBuffers::Alloc(
        capacity = kMaxLinearBufferSize;
    }

    // TODO: read usage from intf
    C2MemoryUsage usage = { C2MemoryUsage::CPU_READ, C2MemoryUsage::CPU_WRITE };
    int64_t usageValue = 0;
    (void)format->findInt64("android._C2MemoryUsage", &usageValue);
    C2MemoryUsage usage{usageValue | C2MemoryUsage::CPU_READ | C2MemoryUsage::CPU_WRITE};
    std::shared_ptr<C2LinearBlock> block;

    c2_status_t err = pool->fetchLinearBlock(capacity, usage, &block);
@@ -1040,8 +1041,9 @@ size_t GraphicInputBuffers::numActiveSlots() const {
}

sp<Codec2Buffer> GraphicInputBuffers::createNewBuffer() {
    // TODO: read usage from intf
    C2MemoryUsage usage = { C2MemoryUsage::CPU_READ, C2MemoryUsage::CPU_WRITE };
    int64_t usageValue = 0;
    (void)mFormat->findInt64("android._C2MemoryUsage", &usageValue);
    C2MemoryUsage usage{usageValue | C2MemoryUsage::CPU_READ | C2MemoryUsage::CPU_WRITE};
    return AllocateGraphicBuffer(
            mPool, mFormat, HAL_PIXEL_FORMAT_YV12, usage, mLocalBufferPool);
}