diff options
author | Ronghua Wu <ronghuawu@google.com> | 2015-07-18 03:07:04 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-07-18 03:07:05 +0000 |
commit | 51390b48d311d1164a6638d3fe0b4a48aaa9028f (patch) | |
tree | edb401cf9346bb27d1126df49ec15d61edf3a62a /media | |
parent | f6d07bc61fd7fefe9d2b2cbdaf637f2fdb1bd21e (diff) | |
parent | 37c8924c508a7c9b8bd3c8ce80fc005070531902 (diff) | |
download | frameworks_av-51390b48d311d1164a6638d3fe0b4a48aaa9028f.zip frameworks_av-51390b48d311d1164a6638d3fe0b4a48aaa9028f.tar.gz frameworks_av-51390b48d311d1164a6638d3fe0b4a48aaa9028f.tar.bz2 |
Merge "mediaresourcemanager: add pid to removeResource method" into mnc-dev
Diffstat (limited to 'media')
-rw-r--r-- | media/libmedia/IResourceManagerService.cpp | 6 | ||||
-rw-r--r-- | media/libstagefright/MediaCodec.cpp | 24 |
2 files changed, 14 insertions, 16 deletions
diff --git a/media/libmedia/IResourceManagerService.cpp b/media/libmedia/IResourceManagerService.cpp index 6902e99..4598686 100644 --- a/media/libmedia/IResourceManagerService.cpp +++ b/media/libmedia/IResourceManagerService.cpp @@ -85,9 +85,10 @@ public: remote()->transact(ADD_RESOURCE, data, &reply); } - virtual void removeResource(int64_t clientId) { + virtual void removeResource(int pid, int64_t clientId) { Parcel data, reply; data.writeInterfaceToken(IResourceManagerService::getInterfaceDescriptor()); + data.writeInt32(pid); data.writeInt64(clientId); remote()->transact(REMOVE_RESOURCE, data, &reply); @@ -139,8 +140,9 @@ status_t BnResourceManagerService::onTransact( case REMOVE_RESOURCE: { CHECK_INTERFACE(IResourceManagerService, data, reply); + int pid = data.readInt32(); int64_t clientId = data.readInt64(); - removeResource(clientId); + removeResource(pid, clientId); return NO_ERROR; } break; diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp index fb32d3a..09742a4 100644 --- a/media/libstagefright/MediaCodec.cpp +++ b/media/libstagefright/MediaCodec.cpp @@ -54,10 +54,6 @@ namespace android { -static inline int getCallingPid() { - return IPCThreadState::self()->getCallingPid(); -} - static int64_t getId(sp<IResourceManagerClient> client) { return (int64_t) client.get(); } @@ -108,7 +104,8 @@ private: DISALLOW_EVIL_CONSTRUCTORS(ResourceManagerClient); }; -MediaCodec::ResourceManagerServiceProxy::ResourceManagerServiceProxy() { +MediaCodec::ResourceManagerServiceProxy::ResourceManagerServiceProxy() + : mPid(IPCThreadState::self()->getCallingPid()) { } MediaCodec::ResourceManagerServiceProxy::~ResourceManagerServiceProxy() { @@ -135,7 +132,6 @@ void MediaCodec::ResourceManagerServiceProxy::binderDied(const wp<IBinder>& /*wh } void MediaCodec::ResourceManagerServiceProxy::addResource( - int pid, int64_t clientId, const sp<IResourceManagerClient> client, const Vector<MediaResource> &resources) { @@ -143,7 +139,7 @@ void MediaCodec::ResourceManagerServiceProxy::addResource( if (mService == NULL) { return; } - mService->addResource(pid, clientId, client, resources); + mService->addResource(mPid, clientId, client, resources); } void MediaCodec::ResourceManagerServiceProxy::removeResource(int64_t clientId) { @@ -151,16 +147,16 @@ void MediaCodec::ResourceManagerServiceProxy::removeResource(int64_t clientId) { if (mService == NULL) { return; } - mService->removeResource(clientId); + mService->removeResource(mPid, clientId); } bool MediaCodec::ResourceManagerServiceProxy::reclaimResource( - int callingPid, const Vector<MediaResource> &resources) { + const Vector<MediaResource> &resources) { Mutex::Autolock _l(mLock); if (mService == NULL) { return false; } - return mService->reclaimResource(callingPid, resources); + return mService->reclaimResource(mPid, resources); } // static @@ -375,7 +371,7 @@ status_t MediaCodec::init(const AString &name, bool nameIsType, bool encoder) { for (int i = 0; i <= kMaxRetry; ++i) { if (i > 0) { // Don't try to reclaim resource for the first time. - if (!mResourceManagerService->reclaimResource(getCallingPid(), resources)) { + if (!mResourceManagerService->reclaimResource(resources)) { break; } } @@ -438,7 +434,7 @@ status_t MediaCodec::configure( for (int i = 0; i <= kMaxRetry; ++i) { if (i > 0) { // Don't try to reclaim resource for the first time. - if (!mResourceManagerService->reclaimResource(getCallingPid(), resources)) { + if (!mResourceManagerService->reclaimResource(resources)) { break; } } @@ -517,7 +513,7 @@ void MediaCodec::addResource(const String8 &type, const String8 &subtype, uint64 Vector<MediaResource> resources; resources.push_back(MediaResource(type, subtype, value)); mResourceManagerService->addResource( - getCallingPid(), getId(mResourceManagerClient), mResourceManagerClient, resources); + getId(mResourceManagerClient), mResourceManagerClient, resources); } status_t MediaCodec::start() { @@ -535,7 +531,7 @@ status_t MediaCodec::start() { for (int i = 0; i <= kMaxRetry; ++i) { if (i > 0) { // Don't try to reclaim resource for the first time. - if (!mResourceManagerService->reclaimResource(getCallingPid(), resources)) { + if (!mResourceManagerService->reclaimResource(resources)) { break; } // Recover codec from previous error before retry start. |