From 7c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Fri, 17 Jun 2011 21:29:58 -0700 Subject: Audio framework: support for audio pre processing Audio effect framework is extended to suport effects on output and input audio path. AudioFlinger: Support for audio effects and effect chains is moved from PlaybackThread class to ThreadBase class so that RecordThread can manage effects. Effects of type pre processing are allowed on record thread only. When a pre processing is enabled, the effect interface handle is passed down to the input stream so that the audio HAL can call the process function. The record thread loop calls the effect chain process function that will only manage the effect state and commands and skip the process function. AudioRecord: The audio session is allocated before calling getInput() into audio policy serice so that the session is known before the input theead is created and pre processings can be created on the correct session. AudioPolicyService: default pre processing for a given input source are loaded from audio_effects.conf file. When an input is created, corresponding effects are created and enabled. Change-Id: Id17119e0979b4dcf189b5c7957fec30dc3478790 --- media/libmedia/IAudioPolicyService.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'media/libmedia/IAudioPolicyService.cpp') diff --git a/media/libmedia/IAudioPolicyService.cpp b/media/libmedia/IAudioPolicyService.cpp index 9fbcee0..49d410f 100644 --- a/media/libmedia/IAudioPolicyService.cpp +++ b/media/libmedia/IAudioPolicyService.cpp @@ -184,7 +184,8 @@ public: uint32_t samplingRate, uint32_t format, uint32_t channels, - audio_in_acoustics_t acoustics) + audio_in_acoustics_t acoustics, + int audioSession) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); @@ -193,6 +194,7 @@ public: data.writeInt32(static_cast (format)); data.writeInt32(channels); data.writeInt32(static_cast (acoustics)); + data.writeInt32(audioSession); remote()->transact(GET_INPUT, data, &reply); return static_cast (reply.readInt32()); } @@ -285,7 +287,7 @@ public: } virtual status_t registerEffect(effect_descriptor_t *desc, - audio_io_handle_t output, + audio_io_handle_t io, uint32_t strategy, int session, int id) @@ -293,7 +295,7 @@ public: Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.write(desc, sizeof(effect_descriptor_t)); - data.writeInt32(output); + data.writeInt32(io); data.writeInt32(strategy); data.writeInt32(session); data.writeInt32(id); @@ -439,11 +441,13 @@ status_t BnAudioPolicyService::onTransact( uint32_t channels = data.readInt32(); audio_in_acoustics_t acoustics = static_cast (data.readInt32()); + int audioSession = data.readInt32(); audio_io_handle_t input = getInput(inputSource, samplingRate, format, channels, - acoustics); + acoustics, + audioSession); reply->writeInt32(static_cast (input)); return NO_ERROR; } break; @@ -528,12 +532,12 @@ status_t BnAudioPolicyService::onTransact( CHECK_INTERFACE(IAudioPolicyService, data, reply); effect_descriptor_t desc; data.read(&desc, sizeof(effect_descriptor_t)); - audio_io_handle_t output = data.readInt32(); + audio_io_handle_t io = data.readInt32(); uint32_t strategy = data.readInt32(); int session = data.readInt32(); int id = data.readInt32(); reply->writeInt32(static_cast (registerEffect(&desc, - output, + io, strategy, session, id))); -- cgit v1.1