BufferQueueConsumer: signal onFrameReleased on dropped frames
Bug: 22552826 Change-Id: I9bdfeb8c68f403301af90d4b494f0ae7166a767c
This commit is contained in:
parent
c968c0175e
commit
5f920c1a2c
@ -38,6 +38,10 @@ BufferQueueConsumer::~BufferQueueConsumer() {}
|
|||||||
status_t BufferQueueConsumer::acquireBuffer(BufferItem* outBuffer,
|
status_t BufferQueueConsumer::acquireBuffer(BufferItem* outBuffer,
|
||||||
nsecs_t expectedPresent, uint64_t maxFrameNumber) {
|
nsecs_t expectedPresent, uint64_t maxFrameNumber) {
|
||||||
ATRACE_CALL();
|
ATRACE_CALL();
|
||||||
|
|
||||||
|
int numDroppedBuffers = 0;
|
||||||
|
sp<IProducerListener> listener;
|
||||||
|
{
|
||||||
Mutex::Autolock lock(mCore->mMutex);
|
Mutex::Autolock lock(mCore->mMutex);
|
||||||
|
|
||||||
// Check that the consumer doesn't currently have the maximum number of
|
// 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
|
// Front buffer is still in mSlots, so mark the slot as free
|
||||||
mSlots[front->mSlot].mBufferState = BufferSlot::FREE;
|
mSlots[front->mSlot].mBufferState = BufferSlot::FREE;
|
||||||
mCore->mFreeBuffers.push_back(front->mSlot);
|
mCore->mFreeBuffers.push_back(front->mSlot);
|
||||||
|
listener = mCore->mConnectedProducerListener;
|
||||||
|
++numDroppedBuffers;
|
||||||
}
|
}
|
||||||
mCore->mQueue.erase(front);
|
mCore->mQueue.erase(front);
|
||||||
front = mCore->mQueue.begin();
|
front = mCore->mQueue.begin();
|
||||||
@ -187,6 +193,13 @@ status_t BufferQueueConsumer::acquireBuffer(BufferItem* outBuffer,
|
|||||||
ATRACE_INT(mCore->mConsumerName.string(), mCore->mQueue.size());
|
ATRACE_INT(mCore->mConsumerName.string(), mCore->mQueue.size());
|
||||||
|
|
||||||
mCore->validateConsistencyLocked();
|
mCore->validateConsistencyLocked();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listener != NULL) {
|
||||||
|
for (int i = 0; i < numDroppedBuffers; ++i) {
|
||||||
|
listener->onBufferReleased();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user