diff options
author | Andreas Huber <andih@google.com> | 2013-07-31 13:50:42 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2013-08-13 10:11:46 -0700 |
commit | a61285dcf1da8a2cf40c499ee3a7b9fc4d74ac58 (patch) | |
tree | a360123ee73434ee45608b03a02d8fb6ff431c3b /media/libstagefright/omx/GraphicBufferSource.h | |
parent | 1b832c3d8f2b1b24f9bc7025afd2b4a8b4e6c6f9 (diff) | |
download | frameworks_av-a61285dcf1da8a2cf40c499ee3a7b9fc4d74ac58.zip frameworks_av-a61285dcf1da8a2cf40c499ee3a7b9fc4d74ac58.tar.gz frameworks_av-a61285dcf1da8a2cf40c499ee3a7b9fc4d74ac58.tar.bz2 |
Optionally repeat the previously submitted frame to the encoder
if no new frame has been delivered by surface flinger within the timeout
interval.
Change-Id: I282f1b726dfe5646b178d7858d6f5d4f5a264fde
Diffstat (limited to 'media/libstagefright/omx/GraphicBufferSource.h')
-rw-r--r-- | media/libstagefright/omx/GraphicBufferSource.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/media/libstagefright/omx/GraphicBufferSource.h b/media/libstagefright/omx/GraphicBufferSource.h index ac73770..244a843 100644 --- a/media/libstagefright/omx/GraphicBufferSource.h +++ b/media/libstagefright/omx/GraphicBufferSource.h @@ -25,6 +25,8 @@ #include <OMX_Core.h> #include "../include/OMXNodeInstance.h" #include <media/stagefright/foundation/ABase.h> +#include <media/stagefright/foundation/AHandlerReflector.h> +#include <media/stagefright/foundation/ALooper.h> namespace android { @@ -89,6 +91,15 @@ public: // in the BufferQueue) will be discarded until the suspension is lifted. void suspend(bool suspend); + // Specifies the interval after which we requeue the buffer previously + // queued to the encoder. This is useful in the case of surface flinger + // providing the input surface if the resulting encoded stream is to + // be displayed "live". If we were not to push through the extra frame + // the decoder on the remote end would be unable to decode the latest frame. + // This API must be called before transitioning the encoder to "executing" + // state and once this behaviour is specified it cannot be reset. + status_t setRepeatPreviousFrameDelayUs(int64_t repeatAfterUs); + protected: // BufferQueue::ConsumerListener interface, called when a new frame of // data is available. If we're executing and a codec buffer is @@ -147,6 +158,9 @@ private: // doing anything if we don't have a codec buffer available. void submitEndOfInputStream_l(); + void setLatestSubmittedBuffer_l(const BufferQueue::BufferItem &item); + bool repeatLatestSubmittedBuffer_l(); + // Lock, covers all member variables. mutable Mutex mMutex; @@ -181,6 +195,30 @@ private: // Tracks codec buffers. Vector<CodecBuffer> mCodecBuffers; + //// + friend class AHandlerReflector<GraphicBufferSource>; + + enum { + kWhatRepeatLastFrame, + }; + + int64_t mRepeatAfterUs; + + sp<ALooper> mLooper; + sp<AHandlerReflector<GraphicBufferSource> > mReflector; + + int32_t mRepeatLastFrameGeneration; + + int mLatestSubmittedBufferId; + uint64_t mLatestSubmittedBufferFrameNum; + int32_t mLatestSubmittedBufferUseCount; + + // The previously submitted buffer should've been repeated but + // no codec buffer was available at the time. + bool mRepeatBufferDeferred; + + void onMessageReceived(const sp<AMessage> &msg); + DISALLOW_EVIL_CONSTRUCTORS(GraphicBufferSource); }; |