summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/AudioFlinger.cpp
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2014-02-11 08:47:07 -0800
committerMarco Nelissen <marcone@google.com>2014-02-11 12:39:43 -0800
commitd457c970c8d08519cd77280a90b61ae1e342cfe3 (patch)
treef0f409db4d834b4d70b2244dd97dfa707496df50 /services/audioflinger/AudioFlinger.cpp
parent1d6fa7af1288b550faabe4ec2cf98684236723db (diff)
downloadframeworks_av-d457c970c8d08519cd77280a90b61ae1e342cfe3.zip
frameworks_av-d457c970c8d08519cd77280a90b61ae1e342cfe3.tar.gz
frameworks_av-d457c970c8d08519cd77280a90b61ae1e342cfe3.tar.bz2
Track pid for each session
so they can be properly freed. Change-Id: I6f389035bc29e74e7c367c1c6d0252b180f666b3
Diffstat (limited to 'services/audioflinger/AudioFlinger.cpp')
-rw-r--r--services/audioflinger/AudioFlinger.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 21bd2f4..b74fa89 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1929,18 +1929,21 @@ int AudioFlinger::newAudioSessionId()
return nextUniqueId();
}
-void AudioFlinger::acquireAudioSessionId(int audioSession)
+void AudioFlinger::acquireAudioSessionId(int audioSession, pid_t pid)
{
Mutex::Autolock _l(mLock);
pid_t caller = IPCThreadState::self()->getCallingPid();
- ALOGV("acquiring %d from %d", audioSession, caller);
+ ALOGV("acquiring %d from %d, for %d", audioSession, caller, pid);
+ if (pid != -1 && (caller == getpid_cached)) {
+ caller = pid;
+ }
// Ignore requests received from processes not known as notification client. The request
// is likely proxied by mediaserver (e.g CameraService) and releaseAudioSessionId() can be
// called from a different pid leaving a stale session reference. Also we don't know how
// to clear this reference if the client process dies.
if (mNotificationClients.indexOfKey(caller) < 0) {
- ALOGV("acquireAudioSessionId() unknown client %d for session %d", caller, audioSession);
+ ALOGW("acquireAudioSessionId() unknown client %d for session %d", caller, audioSession);
return;
}
@@ -1957,11 +1960,14 @@ void AudioFlinger::acquireAudioSessionId(int audioSession)
ALOGV(" added new entry for %d", audioSession);
}
-void AudioFlinger::releaseAudioSessionId(int audioSession)
+void AudioFlinger::releaseAudioSessionId(int audioSession, pid_t pid)
{
Mutex::Autolock _l(mLock);
pid_t caller = IPCThreadState::self()->getCallingPid();
- ALOGV("releasing %d from %d", audioSession, caller);
+ ALOGV("releasing %d from %d for %d", audioSession, caller, pid);
+ if (pid != -1 && (caller == getpid_cached)) {
+ caller = pid;
+ }
size_t num = mAudioSessionRefs.size();
for (size_t i = 0; i< num; i++) {
AudioSessionRef *ref = mAudioSessionRefs.itemAt(i);