audioflinger: fix reused audio patch resource release
Add missing explicit release of audio HAL patch
when a patch is created reusing the same patch handle but
the source or sink devices are not on the same HW module.
Bug: 28953359
Change-Id: Ib751a4b5b2badd745f3b43e69734dd6a3e60eabe
diff --git a/services/audioflinger/PatchPanel.h b/services/audioflinger/PatchPanel.h
index e31179c..16ec278 100644
--- a/services/audioflinger/PatchPanel.h
+++ b/services/audioflinger/PatchPanel.h
@@ -62,12 +62,24 @@
struct audio_patch mAudioPatch;
audio_patch_handle_t mHandle;
+ // handle for audio HAL patch handle present only when the audio HAL version is >= 3.0
audio_patch_handle_t mHalHandle;
+ // below members are used by a software audio patch connecting a source device from a
+ // given audio HW module to a sink device on an other audio HW module.
+ // playback thread created by createAudioPatch() and released by clearPatchConnections() if
+ // no existing playback thread can be used by the software patch
sp<PlaybackThread> mPlaybackThread;
+ // audio track created by createPatchConnections() and released by clearPatchConnections()
sp<PlaybackThread::PatchTrack> mPatchTrack;
+ // record thread created by createAudioPatch() and released by clearPatchConnections()
sp<RecordThread> mRecordThread;
+ // audio record created by createPatchConnections() and released by clearPatchConnections()
sp<RecordThread::PatchRecord> mPatchRecord;
+ // handle for audio patch connecting source device to record thread input.
+ // created by createPatchConnections() and released by clearPatchConnections()
audio_patch_handle_t mRecordPatchHandle;
+ // handle for audio patch connecting playback thread output to sink device
+ // created by createPatchConnections() and released by clearPatchConnections()
audio_patch_handle_t mPlaybackPatchHandle;
};