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/AudioFlinger.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'services/audioflinger/AudioFlinger.h') diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h index bae18fd..2830e6d 100644 --- a/services/audioflinger/AudioFlinger.h +++ b/services/audioflinger/AudioFlinger.h @@ -489,6 +489,18 @@ private: PlaybackThread *checkPlaybackThread_l(audio_io_handle_t output) const; MixerThread *checkMixerThread_l(audio_io_handle_t output) const; RecordThread *checkRecordThread_l(audio_io_handle_t input) const; + sp openInput_l(audio_module_handle_t module, + audio_devices_t device, + struct audio_config *config, + audio_input_flags_t flags); + sp openOutput_l(audio_module_handle_t module, + audio_devices_t device, + struct audio_config *config, + audio_output_flags_t flags); + + void closeOutputFinish(sp thread); + void closeInputFinish(sp thread); + // no range check, AudioFlinger::mLock held bool streamMute_l(audio_stream_type_t stream) const { return mStreamTypes[stream].mute; } @@ -530,10 +542,11 @@ private: AHWD_CAN_SET_MASTER_MUTE = 0x2, }; - AudioHwDevice(const char *moduleName, + AudioHwDevice(audio_module_handle_t handle, + const char *moduleName, audio_hw_device_t *hwDevice, Flags flags) - : mModuleName(strdup(moduleName)) + : mHandle(handle), mModuleName(strdup(moduleName)) , mHwDevice(hwDevice) , mFlags(flags) { } /*virtual*/ ~AudioHwDevice() { free((void *)mModuleName); } @@ -546,11 +559,13 @@ private: return (0 != (mFlags & AHWD_CAN_SET_MASTER_MUTE)); } + audio_module_handle_t handle() const { return mHandle; } const char *moduleName() const { return mModuleName; } audio_hw_device_t *hwDevice() const { return mHwDevice; } uint32_t version() const { return mHwDevice->common.version; } private: + audio_module_handle_t mHandle; const char * const mModuleName; audio_hw_device_t * const mHwDevice; const Flags mFlags; @@ -669,7 +684,9 @@ private: // for use from destructor status_t closeOutput_nonvirtual(audio_io_handle_t output); + void closeOutputInternal_l(sp thread); status_t closeInput_nonvirtual(audio_io_handle_t input); + void closeInputInternal_l(sp thread); #ifdef TEE_SINK // all record threads serially share a common tee sink, which is re-created on format change -- cgit v1.1