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

Commit d134a68a authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8903569 from d964e2eb to tm-qpr1-release

Change-Id: Ib5e9687c282189b45a0b79a92a8dab50522575e7
parents b38d357a d964e2eb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1899,6 +1899,7 @@ void CCodec::stop() {
        comp = state->comp;
    }
    status_t err = comp->stop();
    mChannel->stopUseOutputSurface();
    if (err != C2_OK) {
        // TODO: convert err into status_t
        mCallback->onError(UNKNOWN_ERROR, ACTION_CODE_FATAL);
@@ -1972,6 +1973,7 @@ void CCodec::initiateRelease(bool sendCallback /* = true */) {
    }

    mChannel->reset();
    mChannel->stopUseOutputSurface();
    // thiz holds strong ref to this while the thread is running.
    sp<CCodec> thiz(this);
    std::thread([thiz, sendCallback] { thiz->release(sendCallback); }).detach();
+11 −8
Original line number Diff line number Diff line
@@ -1578,6 +1578,17 @@ void CCodecBufferChannel::stop() {
    mFirstValidFrameIndex = mFrameIndex.load(std::memory_order_relaxed);
}

void CCodecBufferChannel::stopUseOutputSurface() {
    if (mOutputSurface.lock()->surface) {
        C2BlockPool::local_id_t outputPoolId;
        {
            Mutexed<BlockPools>::Locked pools(mBlockPools);
            outputPoolId = pools->outputPoolId;
        }
        if (mComponent) mComponent->stopUsingOutputSurface(outputPoolId);
    }
}

void CCodecBufferChannel::reset() {
    stop();
    if (mInputSurface != nullptr) {
@@ -1593,14 +1604,6 @@ void CCodecBufferChannel::reset() {
        Mutexed<Output>::Locked output(mOutput);
        output->buffers.reset();
    }
    if (mOutputSurface.lock()->surface) {
        C2BlockPool::local_id_t outputPoolId;
        {
            Mutexed<BlockPools>::Locked pools(mBlockPools);
            outputPoolId = pools->outputPoolId;
        }
        mComponent->stopUsingOutputSurface(outputPoolId);
    }
}

void CCodecBufferChannel::release() {
+6 −0
Original line number Diff line number Diff line
@@ -148,6 +148,12 @@ public:
    status_t requestInitialInputBuffers(
            std::map<size_t, sp<MediaCodecBuffer>> &&clientInputBuffers);

    /**
     * Stop using buffers of the current output surface for other Codec
     * instances to use the surface safely.
     */
    void stopUseOutputSurface();

    /**
     * Stop queueing buffers to the component. This object should never queue
     * buffers after this call, until start() is called.