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

Commit 5fea7f7e authored by Wonsik Kim's avatar Wonsik Kim Committed by Automerger Merge Worker
Browse files

Merge "CCodec: don't release all references at flush" am: d22cd941 am: 9db4c91f

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

Change-Id: Ic8fb780134f346a8f5f4bd130bd5a2a76605b8dc
parents 869385ac 9db4c91f
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -1348,7 +1348,7 @@ status_t CCodecBufferChannel::start(
    // about buffers from the previous generation do not interfere with the
    // newly initialized pipeline capacity.

    {
    if (inputFormat || outputFormat) {
        Mutexed<PipelineWatcher>::Locked watcher(mPipelineWatcher);
        watcher->inputDelay(inputDelayValue)
                .pipelineDelay(pipelineDelayValue)
@@ -1448,14 +1448,14 @@ status_t CCodecBufferChannel::requestInitialInputBuffers() {
void CCodecBufferChannel::stop() {
    mSync.stop();
    mFirstValidFrameIndex = mFrameIndex.load(std::memory_order_relaxed);
    if (mInputSurface != nullptr) {
        mInputSurface.reset();
    }
    mPipelineWatcher.lock()->flush();
}

void CCodecBufferChannel::reset() {
    stop();
    if (mInputSurface != nullptr) {
        mInputSurface.reset();
    }
    mPipelineWatcher.lock()->flush();
    {
        Mutexed<Input>::Locked input(mInput);
        input->buffers.reset(new DummyInputBuffers(""));
@@ -1483,8 +1483,10 @@ void CCodecBufferChannel::release() {

void CCodecBufferChannel::flush(const std::list<std::unique_ptr<C2Work>> &flushedWork) {
    ALOGV("[%s] flush", mName);
    std::vector<uint64_t> indices;
    std::list<std::unique_ptr<C2Work>> configs;
    for (const std::unique_ptr<C2Work> &work : flushedWork) {
        indices.push_back(work->input.ordinal.frameIndex.peeku());
        if (!(work->input.flags & C2FrameData::FLAG_CODEC_CONFIG)) {
            continue;
        }
@@ -1497,6 +1499,7 @@ void CCodecBufferChannel::flush(const std::list<std::unique_ptr<C2Work>> &flushe
        std::unique_ptr<C2Work> copy(new C2Work);
        copy->input.flags = C2FrameData::flags_t(work->input.flags | C2FrameData::FLAG_DROP_FRAME);
        copy->input.ordinal = work->input.ordinal;
        copy->input.ordinal.frameIndex = mFrameIndex++;
        copy->input.buffers.insert(
                copy->input.buffers.begin(),
                work->input.buffers.begin(),
@@ -1525,7 +1528,12 @@ void CCodecBufferChannel::flush(const std::list<std::unique_ptr<C2Work>> &flushe
            output->buffers->flushStash();
        }
    }
    mPipelineWatcher.lock()->flush();
    {
        Mutexed<PipelineWatcher>::Locked watcher(mPipelineWatcher);
        for (uint64_t index : indices) {
            watcher->onWorkDone(index);
        }
    }
}

void CCodecBufferChannel::onWorkDone(
+1 −0
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ void PipelineWatcher::onWorkDone(uint64_t frameIndex) {
}

void PipelineWatcher::flush() {
    ALOGV("flush");
    mFramesInPipeline.clear();
}