From 83b8808faad1e91690c64d7007348be8d9ebde73 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Fri, 20 Jun 2014 18:31:16 -0700 Subject: audio flinger: add patch connection between hw modules Add support for audio device connections between different audio hw modules. The patch is performed by creating a bridge between the playback thread connected to the sink device and the record thread connected to the source device using a pair of specialized PlaybackTrack and RecordTrack. - Added PatchTrack and PatchRecord classes. - Added TrackBase type to indicate more clearly the track behavior. - A TrackBase can allocate the buffer or reuse an existing one. - Factored some code in openOutput() and openInput() for internal use by PatchPanel. Bug: 14815883. Change-Id: Ib9515fcda864610458a4bc81fa8f59096ff4d7db --- services/audioflinger/PatchPanel.h | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'services/audioflinger/PatchPanel.h') diff --git a/services/audioflinger/PatchPanel.h b/services/audioflinger/PatchPanel.h index 7f78621..e31179c 100644 --- a/services/audioflinger/PatchPanel.h +++ b/services/audioflinger/PatchPanel.h @@ -21,6 +21,9 @@ class PatchPanel : public RefBase { public: + + class Patch; + PatchPanel(const sp& audioFlinger); virtual ~PatchPanel(); @@ -45,16 +48,31 @@ public: /* Set audio port configuration */ status_t setAudioPortConfig(const struct audio_port_config *config); + status_t createPatchConnections(Patch *patch, + const struct audio_patch *audioPatch); + void clearPatchConnections(Patch *patch); + class Patch { public: Patch(const struct audio_patch *patch) : - mAudioPatch(*patch), mHandle(0), mHalHandle(0) {} + mAudioPatch(*patch), mHandle(AUDIO_PATCH_HANDLE_NONE), + mHalHandle(AUDIO_PATCH_HANDLE_NONE), mRecordPatchHandle(AUDIO_PATCH_HANDLE_NONE), + mPlaybackPatchHandle(AUDIO_PATCH_HANDLE_NONE) {} + ~Patch() {} + + struct audio_patch mAudioPatch; + audio_patch_handle_t mHandle; + audio_patch_handle_t mHalHandle; + sp mPlaybackThread; + sp mPatchTrack; + sp mRecordThread; + sp mPatchRecord; + audio_patch_handle_t mRecordPatchHandle; + audio_patch_handle_t mPlaybackPatchHandle; - struct audio_patch mAudioPatch; - audio_patch_handle_t mHandle; - audio_patch_handle_t mHalHandle; }; + private: - const wp mAudioFlinger; - SortedVector mPatches; + const wp mAudioFlinger; + SortedVector mPatches; }; -- cgit v1.1