Merge "libgui: Hook up onFrameReplaced"
This commit is contained in:
commit
38d7f7550f
@ -62,9 +62,10 @@ public:
|
|||||||
public:
|
public:
|
||||||
ProxyConsumerListener(const wp<ConsumerListener>& consumerListener);
|
ProxyConsumerListener(const wp<ConsumerListener>& consumerListener);
|
||||||
virtual ~ProxyConsumerListener();
|
virtual ~ProxyConsumerListener();
|
||||||
virtual void onFrameAvailable(const BufferItem& item);
|
virtual void onFrameAvailable(const BufferItem& item) override;
|
||||||
virtual void onBuffersReleased();
|
virtual void onFrameReplaced(const BufferItem& item) override;
|
||||||
virtual void onSidebandStreamChanged();
|
virtual void onBuffersReleased() override;
|
||||||
|
virtual void onSidebandStreamChanged() override;
|
||||||
private:
|
private:
|
||||||
// mConsumerListener is a weak reference to the IConsumerListener. This is
|
// mConsumerListener is a weak reference to the IConsumerListener. This is
|
||||||
// the raison d'etre of ProxyConsumerListener.
|
// the raison d'etre of ProxyConsumerListener.
|
||||||
|
@ -38,15 +38,9 @@ class ConsumerBase : public virtual RefBase,
|
|||||||
protected ConsumerListener {
|
protected ConsumerListener {
|
||||||
public:
|
public:
|
||||||
struct FrameAvailableListener : public virtual RefBase {
|
struct FrameAvailableListener : public virtual RefBase {
|
||||||
// onFrameAvailable() is called each time an additional frame becomes
|
// See IConsumerListener::onFrame{Available,Replaced}
|
||||||
// available for consumption. This means that frames that are queued
|
|
||||||
// while in asynchronous mode only trigger the callback if no previous
|
|
||||||
// frames are pending. Frames queued while in synchronous mode always
|
|
||||||
// trigger the callback.
|
|
||||||
//
|
|
||||||
// This is called without any lock held and can be called concurrently
|
|
||||||
// by multiple threads.
|
|
||||||
virtual void onFrameAvailable(const BufferItem& item) = 0;
|
virtual void onFrameAvailable(const BufferItem& item) = 0;
|
||||||
|
virtual void onFrameReplaced(const BufferItem& /* item */) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~ConsumerBase();
|
virtual ~ConsumerBase();
|
||||||
@ -104,14 +98,16 @@ protected:
|
|||||||
|
|
||||||
// Implementation of the IConsumerListener interface. These
|
// Implementation of the IConsumerListener interface. These
|
||||||
// calls are used to notify the ConsumerBase of asynchronous events in the
|
// calls are used to notify the ConsumerBase of asynchronous events in the
|
||||||
// BufferQueue. The onFrameAvailable and onBuffersReleased methods should
|
// BufferQueue. The onFrameAvailable, onFrameReplaced, and
|
||||||
// not need to be overridden by derived classes, but if they are overridden
|
// onBuffersReleased methods should not need to be overridden by derived
|
||||||
// the ConsumerBase implementation must be called from the derived class.
|
// classes, but if they are overridden the ConsumerBase implementation must
|
||||||
// The ConsumerBase version of onSidebandStreamChanged does nothing and can
|
// be called from the derived class. The ConsumerBase version of
|
||||||
// be overriden by derived classes if they want the notification.
|
// onSidebandStreamChanged does nothing and can be overriden by derived
|
||||||
virtual void onFrameAvailable(const BufferItem& item);
|
// classes if they want the notification.
|
||||||
virtual void onBuffersReleased();
|
virtual void onFrameAvailable(const BufferItem& item) override;
|
||||||
virtual void onSidebandStreamChanged();
|
virtual void onFrameReplaced(const BufferItem& item) override;
|
||||||
|
virtual void onBuffersReleased() override;
|
||||||
|
virtual void onSidebandStreamChanged() override;
|
||||||
|
|
||||||
// freeBufferLocked frees up the given buffer slot. If the slot has been
|
// freeBufferLocked frees up the given buffer slot. If the slot has been
|
||||||
// initialized this will release the reference to the GraphicBuffer in that
|
// initialized this will release the reference to the GraphicBuffer in that
|
||||||
|
@ -39,6 +39,14 @@ void BufferQueue::ProxyConsumerListener::onFrameAvailable(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BufferQueue::ProxyConsumerListener::onFrameReplaced(
|
||||||
|
const BufferItem& item) {
|
||||||
|
sp<ConsumerListener> listener(mConsumerListener.promote());
|
||||||
|
if (listener != NULL) {
|
||||||
|
listener->onFrameReplaced(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BufferQueue::ProxyConsumerListener::onBuffersReleased() {
|
void BufferQueue::ProxyConsumerListener::onBuffersReleased() {
|
||||||
sp<ConsumerListener> listener(mConsumerListener.promote());
|
sp<ConsumerListener> listener(mConsumerListener.promote());
|
||||||
if (listener != NULL) {
|
if (listener != NULL) {
|
||||||
|
@ -114,6 +114,21 @@ void ConsumerBase::onFrameAvailable(const BufferItem& item) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConsumerBase::onFrameReplaced(const BufferItem &item) {
|
||||||
|
CB_LOGV("onFrameReplaced");
|
||||||
|
|
||||||
|
sp<FrameAvailableListener> listener;
|
||||||
|
{
|
||||||
|
Mutex::Autolock lock(mMutex);
|
||||||
|
listener = mFrameAvailableListener.promote();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listener != NULL) {
|
||||||
|
CB_LOGV("actually calling onFrameReplaced");
|
||||||
|
listener->onFrameReplaced(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ConsumerBase::onBuffersReleased() {
|
void ConsumerBase::onBuffersReleased() {
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
|
|
||||||
|
@ -339,9 +339,9 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Interface implementation for SurfaceFlingerConsumer::ContentsChangedListener
|
// Interface implementation for SurfaceFlingerConsumer::ContentsChangedListener
|
||||||
virtual void onFrameAvailable(const BufferItem& item);
|
virtual void onFrameAvailable(const BufferItem& item) override;
|
||||||
virtual void onFrameReplaced(const BufferItem& item);
|
virtual void onFrameReplaced(const BufferItem& item) override;
|
||||||
virtual void onSidebandStreamChanged();
|
virtual void onSidebandStreamChanged() override;
|
||||||
|
|
||||||
void commitTransaction();
|
void commitTransaction();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user