summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Tracks.cpp
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2013-09-12 09:21:43 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-09-12 09:21:43 -0700
commitf523897787b64cf2217d0ab4946b564420c675fe (patch)
treebf4361fd297eabb324294ce8e30e95b50176a85e /services/audioflinger/Tracks.cpp
parentd5577f26de1ae3a0dc6fbea9c60a07d585f894bf (diff)
parent8a220740cd77eb844123d3914190a94513797b40 (diff)
downloadframeworks_av-f523897787b64cf2217d0ab4946b564420c675fe.zip
frameworks_av-f523897787b64cf2217d0ab4946b564420c675fe.tar.gz
frameworks_av-f523897787b64cf2217d0ab4946b564420c675fe.tar.bz2
am 8a220740: am dc33c542: Merge "Fix AudioTrack shared memory leak" into klp-dev
* commit '8a220740cd77eb844123d3914190a94513797b40': Fix AudioTrack shared memory leak
Diffstat (limited to 'services/audioflinger/Tracks.cpp')
-rw-r--r--services/audioflinger/Tracks.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 0f0b7b6..047b481 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -364,6 +364,16 @@ AudioFlinger::PlaybackThread::Track::Track(
AudioFlinger::PlaybackThread::Track::~Track()
{
ALOGV("PlaybackThread::Track destructor");
+
+ // The destructor would clear mSharedBuffer,
+ // but it will not push the decremented reference count,
+ // leaving the client's IMemory dangling indefinitely.
+ // This prevents that leak.
+ if (mSharedBuffer != 0) {
+ mSharedBuffer.clear();
+ // flush the binder command buffer
+ IPCThreadState::self()->flushCommands();
+ }
}
status_t AudioFlinger::PlaybackThread::Track::initCheck() const