summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Tracks.cpp
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2014-09-16 08:47:54 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-16 08:47:54 +0000
commite716ae7a76941932535cd47ae454423dee598c1e (patch)
treeabb20cd4e79bac3e49a8071bd7fd643550969ca3 /services/audioflinger/Tracks.cpp
parent20ac005f3747d2301959f92cd53eb1815e331fa8 (diff)
parentf5e9870228db68d9cb927ff49f2e46dabfb7bbec (diff)
downloadframeworks_av-e716ae7a76941932535cd47ae454423dee598c1e.zip
frameworks_av-e716ae7a76941932535cd47ae454423dee598c1e.tar.gz
frameworks_av-e716ae7a76941932535cd47ae454423dee598c1e.tar.bz2
am f5e98702: am cf7863ea: Merge "audioflinger: fix pre processing effect leak" into lmp-dev
* commit 'f5e9870228db68d9cb927ff49f2e46dabfb7bbec': audioflinger: fix pre processing effect leak
Diffstat (limited to 'services/audioflinger/Tracks.cpp')
-rw-r--r--services/audioflinger/Tracks.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index c718b0c..d6ed910 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -96,7 +96,8 @@ AudioFlinger::ThreadBase::TrackBase::TrackBase(
mServerProxy(NULL),
mId(android_atomic_inc(&nextTrackId)),
mTerminated(false),
- mType(type)
+ mType(type),
+ mThreadIoHandle(thread->id())
{
// if the caller is us, trust the specified uid
if (IPCThreadState::self()->getCallingPid() != getpid_cached || clientUid == -1) {
@@ -482,14 +483,15 @@ void AudioFlinger::PlaybackThread::Track::destroy()
// this Track with its member mTrack.
sp<Track> keep(this);
{ // scope for mLock
+ bool wasActive = false;
sp<ThreadBase> thread = mThread.promote();
if (thread != 0) {
Mutex::Autolock _l(thread->mLock);
PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
- bool wasActive = playbackThread->destroyTrack_l(this);
- if (isExternalTrack() && !wasActive) {
- AudioSystem::releaseOutput(thread->id());
- }
+ wasActive = playbackThread->destroyTrack_l(this);
+ }
+ if (isExternalTrack() && !wasActive) {
+ AudioSystem::releaseOutput(mThreadIoHandle);
}
}
}
@@ -2051,7 +2053,7 @@ void AudioFlinger::RecordThread::RecordTrack::stop()
if (thread != 0) {
RecordThread *recordThread = (RecordThread *)thread.get();
if (recordThread->stop(this) && isExternalTrack()) {
- AudioSystem::stopInput(recordThread->id(), (audio_session_t)mSessionId);
+ AudioSystem::stopInput(mThreadIoHandle, (audio_session_t)mSessionId);
}
}
}
@@ -2061,14 +2063,14 @@ void AudioFlinger::RecordThread::RecordTrack::destroy()
// see comments at AudioFlinger::PlaybackThread::Track::destroy()
sp<RecordTrack> keep(this);
{
+ if (isExternalTrack()) {
+ if (mState == ACTIVE || mState == RESUMING) {
+ AudioSystem::stopInput(mThreadIoHandle, (audio_session_t)mSessionId);
+ }
+ AudioSystem::releaseInput(mThreadIoHandle, (audio_session_t)mSessionId);
+ }
sp<ThreadBase> thread = mThread.promote();
if (thread != 0) {
- if (isExternalTrack()) {
- if (mState == ACTIVE || mState == RESUMING) {
- AudioSystem::stopInput(thread->id(), (audio_session_t)mSessionId);
- }
- AudioSystem::releaseInput(thread->id(), (audio_session_t)mSessionId);
- }
Mutex::Autolock _l(thread->mLock);
RecordThread *recordThread = (RecordThread *) thread.get();
recordThread->destroyTrack_l(this);