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

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

Snap for 7800528 from 1dc98c99 to sc-qpr1-release

Change-Id: I74bb6a3aeffe3d05d5865f72070974dc53bd1ef3
parents 77da9308 1dc98c99
Loading
Loading
Loading
Loading
+14 −4
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@
#include <utils/Log.h>
#include <utils/Log.h>


#include <algorithm>
#include <algorithm>
#include <atomic>
#include <list>
#include <list>
#include <numeric>
#include <numeric>


@@ -155,6 +156,7 @@ CCodecBufferChannel::CCodecBufferChannel(
        input->pipelineDelay = 0u;
        input->pipelineDelay = 0u;
        input->numSlots = kSmoothnessFactor;
        input->numSlots = kSmoothnessFactor;
        input->numExtraSlots = 0u;
        input->numExtraSlots = 0u;
        input->lastFlushIndex = 0u;
    }
    }
    {
    {
        Mutexed<Output>::Locked output(mOutput);
        Mutexed<Output>::Locked output(mOutput);
@@ -1116,6 +1118,7 @@ status_t CCodecBufferChannel::start(
        input->numSlots = numInputSlots;
        input->numSlots = numInputSlots;
        input->extraBuffers.flush();
        input->extraBuffers.flush();
        input->numExtraSlots = 0u;
        input->numExtraSlots = 0u;
        input->lastFlushIndex = mFrameIndex.load(std::memory_order_relaxed);
        if (audioEncoder && encoderFrameSize && sampleRate && channelCount) {
        if (audioEncoder && encoderFrameSize && sampleRate && channelCount) {
            input->frameReassembler.init(
            input->frameReassembler.init(
                    pool,
                    pool,
@@ -1523,6 +1526,7 @@ void CCodecBufferChannel::flush(const std::list<std::unique_ptr<C2Work>> &flushe
    ALOGV("[%s] flush", mName);
    ALOGV("[%s] flush", mName);
    std::vector<uint64_t> indices;
    std::vector<uint64_t> indices;
    std::list<std::unique_ptr<C2Work>> configs;
    std::list<std::unique_ptr<C2Work>> configs;
    mInput.lock()->lastFlushIndex = mFrameIndex.load(std::memory_order_relaxed);
    for (const std::unique_ptr<C2Work> &work : flushedWork) {
    for (const std::unique_ptr<C2Work> &work : flushedWork) {
        indices.push_back(work->input.ordinal.frameIndex.peeku());
        indices.push_back(work->input.ordinal.frameIndex.peeku());
        if (!(work->input.flags & C2FrameData::FLAG_CODEC_CONFIG)) {
        if (!(work->input.flags & C2FrameData::FLAG_CODEC_CONFIG)) {
@@ -1589,14 +1593,20 @@ void CCodecBufferChannel::onInputBufferDone(
    }
    }
    std::shared_ptr<C2Buffer> buffer =
    std::shared_ptr<C2Buffer> buffer =
            mPipelineWatcher.lock()->onInputBufferReleased(frameIndex, arrayIndex);
            mPipelineWatcher.lock()->onInputBufferReleased(frameIndex, arrayIndex);
    bool newInputSlotAvailable;
    bool newInputSlotAvailable = false;
    {
    {
        Mutexed<Input>::Locked input(mInput);
        Mutexed<Input>::Locked input(mInput);
        if (input->lastFlushIndex >= frameIndex) {
            ALOGD("[%s] Ignoring stale input buffer done callback: "
                  "last flush index = %lld, frameIndex = %lld",
                  mName, input->lastFlushIndex.peekll(), (long long)frameIndex);
        } else {
            newInputSlotAvailable = input->buffers->expireComponentBuffer(buffer);
            newInputSlotAvailable = input->buffers->expireComponentBuffer(buffer);
            if (!newInputSlotAvailable) {
            if (!newInputSlotAvailable) {
                (void)input->extraBuffers.expireComponentBuffer(buffer);
                (void)input->extraBuffers.expireComponentBuffer(buffer);
            }
            }
        }
        }
    }
    if (newInputSlotAvailable) {
    if (newInputSlotAvailable) {
        feedInputBufferIfAvailable();
        feedInputBufferIfAvailable();
    }
    }
+1 −0
Original line number Original line Diff line number Diff line
@@ -273,6 +273,7 @@ private:
        size_t numExtraSlots;
        size_t numExtraSlots;
        uint32_t inputDelay;
        uint32_t inputDelay;
        uint32_t pipelineDelay;
        uint32_t pipelineDelay;
        c2_cntr64_t lastFlushIndex;


        FrameReassembler frameReassembler;
        FrameReassembler frameReassembler;
    };
    };