From 67e7f543c7f1c4fe4ee1989ceb0aebe44a63b49e Mon Sep 17 00:00:00 2001 From: Ronghua Wu Date: Fri, 13 Mar 2015 10:47:08 -0700 Subject: media: use ResourceManagerService with MediaCodec Bug: 19620911 Change-Id: I235a97e5195b28645b7834dda0dd77307d93f4a8 --- include/media/stagefright/MediaCodec.h | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'include') diff --git a/include/media/stagefright/MediaCodec.h b/include/media/stagefright/MediaCodec.h index 3e3c276..012a8f4 100644 --- a/include/media/stagefright/MediaCodec.h +++ b/include/media/stagefright/MediaCodec.h @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -34,6 +35,8 @@ struct IBatteryStats; struct ICrypto; struct IMemory; struct MemoryDealer; +class IResourceManagerClient; +class IResourceManagerService; struct SoftwareRenderer; struct Surface; @@ -230,6 +233,30 @@ private: bool mOwnedByClient; }; + struct ResourceManagerServiceProxy : public IBinder::DeathRecipient { + ResourceManagerServiceProxy(); + ~ResourceManagerServiceProxy(); + + void init(); + + // implements DeathRecipient + virtual void binderDied(const wp& /*who*/); + + void addResource( + int pid, + int64_t clientId, + const sp client, + const Vector &resources); + + void removeResource(int64_t clientId); + + bool reclaimResource(int callingPid, const Vector &resources); + + private: + Mutex mLock; + sp mService; + }; + State mState; sp mLooper; sp mCodecLooper; @@ -245,14 +272,22 @@ private: sp mCallback; sp mDealer; + sp mResourceManagerClient; + sp mResourceManagerService; + bool mBatteryStatNotified; bool mIsVideo; + int32_t mVideoWidth; + int32_t mVideoHeight; // initial create parameters AString mInitName; bool mInitNameIsType; bool mInitIsEncoder; + // configure parameter + sp mConfigureMsg; + // Used only to synchronize asynchronous getBufferAndFormat // across all the other (synchronous) buffer state change // operations, such as de/queueIn/OutputBuffer, start and @@ -320,6 +355,9 @@ private: void updateBatteryStat(); bool isExecuting() const; + uint64_t getGraphicBufferSize(); + void addResource(const char *type, uint64_t value); + /* called to get the last codec error when the sticky flag is set. * if no such codec error is found, returns UNKNOWN_ERROR. */ -- cgit v1.1