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

Commit e5942ea2 authored by Lajos Molnar's avatar Lajos Molnar Committed by Android Git Automerger
Browse files

am 1c9f278a: am 173e09a1: am 59d6f2c3: am 5f920c1a: BufferQueueConsumer:...

am 1c9f278a: am 173e09a1: am 59d6f2c3: am 5f920c1a: BufferQueueConsumer: signal onFrameReleased on dropped frames

* commit '1c9f278a':
  BufferQueueConsumer: signal onFrameReleased on dropped frames
parents 0b020958 1c9f278a
Loading
Loading
Loading
Loading
+142 −129
Original line number Diff line number Diff line
@@ -38,6 +38,10 @@ BufferQueueConsumer::~BufferQueueConsumer() {}
status_t BufferQueueConsumer::acquireBuffer(BufferItem* outBuffer,
        nsecs_t expectedPresent, uint64_t maxFrameNumber) {
    ATRACE_CALL();

    int numDroppedBuffers = 0;
    sp<IProducerListener> listener;
    {
        Mutex::Autolock lock(mCore->mMutex);

        // Check that the consumer doesn't currently have the maximum number of
@@ -128,6 +132,8 @@ status_t BufferQueueConsumer::acquireBuffer(BufferItem* outBuffer,
                    // Front buffer is still in mSlots, so mark the slot as free
                    mSlots[front->mSlot].mBufferState = BufferSlot::FREE;
                    mCore->mFreeBuffers.push_back(front->mSlot);
                    listener = mCore->mConnectedProducerListener;
                    ++numDroppedBuffers;
                }
                mCore->mQueue.erase(front);
                front = mCore->mQueue.begin();
@@ -187,6 +193,13 @@ status_t BufferQueueConsumer::acquireBuffer(BufferItem* outBuffer,
        ATRACE_INT(mCore->mConsumerName.string(), mCore->mQueue.size());

        mCore->validateConsistencyLocked();
    }

    if (listener != NULL) {
        for (int i = 0; i < numDroppedBuffers; ++i) {
            listener->onBufferReleased();
        }
    }

    return NO_ERROR;
}