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

Commit f4868da5 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Enable reuse of LinearBlock for during secure playback" into main am:...

Merge "Enable reuse of LinearBlock for during secure playback" into main am: d666832c am: 2c83efe4

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3039900



Change-Id: I871fcd89baacec9a79a48d866cf39cc414139f61
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents f920c6d4 2c83efe4
Loading
Loading
Loading
Loading
+17 −10
Original line number Original line Diff line number Diff line
@@ -2886,6 +2886,10 @@ static void extractMemoryFromContext(
        jint offset,
        jint offset,
        jint size,
        jint size,
        sp<hardware::HidlMemory> *memory) {
        sp<hardware::HidlMemory> *memory) {
    if ((offset + size) > context->capacity()) {
        ALOGW("extractMemoryFromContext: offset + size provided exceed capacity");
        return;
    }
    *memory = context->toHidlMemory();
    *memory = context->toHidlMemory();
    if (*memory == nullptr) {
    if (*memory == nullptr) {
        if (!context->mBlock) {
        if (!context->mBlock) {
@@ -2899,17 +2903,20 @@ static void extractMemoryFromContext(
            ALOGW("extractMemoryFromContext: failed to obtain secure block");
            ALOGW("extractMemoryFromContext: failed to obtain secure block");
            return;
            return;
        }
        }
        C2WriteView view = context->mBlock->map().get();
        *memory = context->toHidlMemory();
        if (view.error() != C2_OK) {
    }
            ALOGW("extractMemoryFromContext: failed to map C2Block (%d)", view.error());
    if (context->mBlock == nullptr || context->mReadWriteMapping == nullptr) {
        ALOGW("extractMemoryFromContext: Cannot extract memory as C2Block is not created/mapped");
        return;
        return;
    }
    }
        uint8_t *memoryPtr = static_cast<uint8_t *>(context->mMemory->unsecurePointer());
    if (context->mReadWriteMapping->error() != C2_OK) {
        memcpy(memoryPtr + offset, view.base() + offset, size);
        ALOGW("extractMemoryFromContext: failed to map C2Block (%d)",
        context->mBlock.reset();
                context->mReadWriteMapping->error());
        context->mReadWriteMapping.reset();
        return;
        *memory = context->toHidlMemory();
    }
    }
    // We are proceeding to extract memory from C2Block
    uint8_t *memoryPtr = static_cast<uint8_t *>(context->mMemory->unsecurePointer());
    memcpy(memoryPtr + offset, context->mReadWriteMapping->base() + offset, size);
}
}


static void extractBufferFromContext(
static void extractBufferFromContext(