Merge "BufferQueue: Hook up IProducerListener"
This commit is contained in:
commit
7f605bd4c0
@ -22,6 +22,7 @@
|
||||
#include <gui/BufferQueueConsumer.h>
|
||||
#include <gui/BufferQueueCore.h>
|
||||
#include <gui/IConsumerListener.h>
|
||||
#include <gui/IProducerListener.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
@ -261,6 +262,8 @@ status_t BufferQueueConsumer::releaseBuffer(int slot, uint64_t frameNumber,
|
||||
return BAD_VALUE;
|
||||
}
|
||||
|
||||
sp<IProducerListener> listener;
|
||||
{ // Autolock scope
|
||||
Mutex::Autolock lock(mCore->mMutex);
|
||||
|
||||
// If the frame number has changed because the buffer has been reallocated,
|
||||
@ -285,6 +288,8 @@ status_t BufferQueueConsumer::releaseBuffer(int slot, uint64_t frameNumber,
|
||||
mSlots[slot].mEglFence = eglFence;
|
||||
mSlots[slot].mFence = releaseFence;
|
||||
mSlots[slot].mBufferState = BufferSlot::FREE;
|
||||
listener = mCore->mConnectedProducerListener;
|
||||
BQ_LOGV("releaseBuffer: releasing slot %d", slot);
|
||||
} else if (mSlots[slot].mNeedsCleanupOnRelease) {
|
||||
BQ_LOGV("releaseBuffer: releasing a stale buffer slot %d "
|
||||
"(state = %d)", slot, mSlots[slot].mBufferState);
|
||||
@ -297,6 +302,12 @@ status_t BufferQueueConsumer::releaseBuffer(int slot, uint64_t frameNumber,
|
||||
}
|
||||
|
||||
mCore->mDequeueCondition.broadcast();
|
||||
} // Autolock scope
|
||||
|
||||
// Call back without lock held
|
||||
if (listener != NULL) {
|
||||
listener->onBufferReleased();
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user