am 5f920c1a
: BufferQueueConsumer: signal onFrameReleased on dropped frames
* commit '5f920c1a2cf12c0638c05fbddee8ff6c1193731c': BufferQueueConsumer: signal onFrameReleased on dropped frames
This commit is contained in:
commit
59d6f2c322
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user