summaryrefslogtreecommitdiffstats
path: root/libs/audioflinger
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2009-08-28 10:39:03 -0700
committerEric Laurent <elaurent@google.com>2009-08-31 02:10:20 -0700
commit7954c4642591fef4ee880411ed29dc1f344f1b6f (patch)
treee39879c86cf4a156246cde57a4a739a41331c8b2 /libs/audioflinger
parent66360af891ac1b77fa5a48d668bd848c84b6f041 (diff)
downloadframeworks_base-7954c4642591fef4ee880411ed29dc1f344f1b6f.zip
frameworks_base-7954c4642591fef4ee880411ed29dc1f344f1b6f.tar.gz
frameworks_base-7954c4642591fef4ee880411ed29dc1f344f1b6f.tar.bz2
Fix issue 2085690: AudioFlinger must properly terminate the input and output threads when destroyed.
Call closeInput() for all inputs and closeOutput() for all outputs before deleting audio hardware in AudioFlinger destructor.
Diffstat (limited to 'libs/audioflinger')
-rw-r--r--libs/audioflinger/AudioFlinger.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index 77a126c..3a419b5 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -136,8 +136,17 @@ AudioFlinger::AudioFlinger()
AudioFlinger::~AudioFlinger()
{
- mRecordThreads.clear();
- mPlaybackThreads.clear();
+ while (!mRecordThreads.isEmpty()) {
+ // closeInput() will remove first entry from mRecordThreads
+ closeInput(mRecordThreads.keyAt(0));
+ }
+ while (!mPlaybackThreads.isEmpty()) {
+ // closeOutput() will remove first entry from mPlaybackThreads
+ closeOutput(mPlaybackThreads.keyAt(0));
+ }
+ if (mAudioHardware) {
+ delete mAudioHardware;
+ }
}