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

Commit 99ae3a0e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "codec2: clean up old block pools" into sc-dev am: 7491da7f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/av/+/13406056

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id6489ae51a2da7c052f60ecdd7a8f21d0c6206ad
parents 35146e67 7491da7f
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -159,6 +159,10 @@ CCodecBufferChannel::CCodecBufferChannel(
        output->outputDelay = 0u;
        output->numSlots = kSmoothnessFactor;
    }
    {
        Mutexed<BlockPools>::Locked pools(mBlockPools);
        pools->outputPoolId = C2BlockPool::BASIC_LINEAR;
    }
}

CCodecBufferChannel::~CCodecBufferChannel() {
@@ -1092,10 +1096,13 @@ status_t CCodecBufferChannel::start(

        bool graphic = (oStreamFormat.value == C2BufferData::GRAPHIC);
        C2BlockPool::local_id_t outputPoolId_;
        C2BlockPool::local_id_t prevOutputPoolId;

        {
            Mutexed<BlockPools>::Locked pools(mBlockPools);

            prevOutputPoolId = pools->outputPoolId;

            // set default allocator ID.
            pools->outputAllocatorId = (graphic) ? C2PlatformAllocatorStore::GRALLOC
                                                 : preferredLinearId;
@@ -1189,6 +1196,15 @@ status_t CCodecBufferChannel::start(
            outputPoolId_ = pools->outputPoolId;
        }

        if (prevOutputPoolId != C2BlockPool::BASIC_LINEAR
                && prevOutputPoolId != C2BlockPool::BASIC_GRAPHIC) {
            c2_status_t err = mComponent->destroyBlockPool(prevOutputPoolId);
            if (err != C2_OK) {
                ALOGW("Failed to clean up previous block pool %llu - %s (%d)\n",
                        (unsigned long long) prevOutputPoolId, asString(err), err);
            }
        }

        Mutexed<Output>::Locked output(mOutput);
        output->outputDelay = outputDelayValue;
        output->numSlots = numOutputSlots;