AudioFlinger: Close MMap threads in destructor
For aesthetic symmetry.
Test: compiles
Change-Id: I5876409cf0ebf0c1945def19bcfd455d87dd4542
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index cd09de6..e13e7aa 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -224,6 +224,14 @@
// closeOutput_nonvirtual() will remove specified entry from mPlaybackThreads
closeOutput_nonvirtual(mPlaybackThreads.keyAt(0));
}
+ while (!mMmapThreads.isEmpty()) {
+ const audio_io_handle_t io = mMmapThreads.keyAt(0);
+ if (mMmapThreads.valueAt(0)->isOutput()) {
+ closeOutput_nonvirtual(io); // removes entry from mMmapThreads
+ } else {
+ closeInput_nonvirtual(io); // removes entry from mMmapThreads
+ }
+ }
for (size_t i = 0; i < mAudioHwDevs.size(); i++) {
// no mHardwareLock needed, as there are no other references to this