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

Commit 9dbb416f authored by Wonsik Kim's avatar Wonsik Kim
Browse files

CCodecBufferChannel: decrease balance for discarded work as well

Bug: 367371849
Test: atest MctsMediaEncoderTestCases
Change-Id: I482c2a731f95b7f8e9c3e4ed4ce7ac4d0aae94df
parent f320a4a8
Loading
Loading
Loading
Loading
+6 −5
Original line number Original line Diff line number Diff line
@@ -2628,8 +2628,6 @@ void CCodecBufferChannel::sendOutputBuffers() {
        switch (action) {
        switch (action) {
        case OutputBuffers::SKIP:
        case OutputBuffers::SKIP:
            return;
            return;
        case OutputBuffers::DISCARD:
            break;
        case OutputBuffers::NOTIFY_CLIENT:
        case OutputBuffers::NOTIFY_CLIENT:
        {
        {
            // TRICKY: we want popped buffers reported in order, so sending
            // TRICKY: we want popped buffers reported in order, so sending
@@ -2656,13 +2654,16 @@ void CCodecBufferChannel::sendOutputBuffers() {
                    outBuffer->meta()->setObject("accessUnitInfo", obj);
                    outBuffer->meta()->setObject("accessUnitInfo", obj);
                }
                }
            }
            }
            mCallback->onOutputBufferAvailable(index, outBuffer);
            [[fallthrough]];
        }
        case OutputBuffers::DISCARD: {
            if (mHasInputSurface && android::media::codec::provider_->input_surface_throttle()) {
            if (mHasInputSurface && android::media::codec::provider_->input_surface_throttle()) {
                Mutexed<InputSurface>::Locked inputSurface(mInputSurface);
                Mutexed<InputSurface>::Locked inputSurface(mInputSurface);
                --inputSurface->numProcessingBuffersBalance;
                --inputSurface->numProcessingBuffersBalance;
                ALOGV("[%s] onOutputBufferAvailable: numProcessingBuffersBalance = %lld",
                ALOGV("[%s] onWorkDone: numProcessingBuffersBalance = %lld",
                        mName, static_cast<long long>(inputSurface->numProcessingBuffersBalance));
                        mName, static_cast<long long>(inputSurface->numProcessingBuffersBalance));
            }
            }
            mCallback->onOutputBufferAvailable(index, outBuffer);
            break;
            break;
        }
        }
        case OutputBuffers::REALLOCATE:
        case OutputBuffers::REALLOCATE: