BufferQueue: fix a test crash

Bug: 10935880
Change-Id: If76e9fb055103bad0db7e6c16487532671573149
This commit is contained in:
Jamie Gennis 2013-09-25 17:21:56 -07:00
parent a9c47f3273
commit f0cf5f103c

View File

@ -668,11 +668,15 @@ status_t BufferQueue::connect(const sp<IBinder>& token,
mConnectedApi = api; mConnectedApi = api;
output->inflate(mDefaultWidth, mDefaultHeight, mTransformHint, mQueue.size()); output->inflate(mDefaultWidth, mDefaultHeight, mTransformHint, mQueue.size());
// set-up a death notification so that we can disconnect automatically // set-up a death notification so that we can disconnect
// when/if the remote producer dies. // automatically when/if the remote producer dies.
// This will fail with INVALID_OPERATION if the "token" is local to our process. if (token != NULL && token->remoteBinder() != NULL) {
if (token->linkToDeath(static_cast<IBinder::DeathRecipient*>(this)) == NO_ERROR) { status_t err = token->linkToDeath(static_cast<IBinder::DeathRecipient*>(this));
if (err == NO_ERROR) {
mConnectedProducerToken = token; mConnectedProducerToken = token;
} else {
ALOGE("linkToDeath failed: %s (%d)", strerror(-err), err);
}
} }
} }
break; break;