From 45ed3b053d9af2250f5ece9ee4e826905c3763a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Gaffie?= Date: Thu, 19 Mar 2015 10:35:14 +0100 Subject: Add EffectDescriptor and associated collection to common elements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds EffectDescriptor and associated collection to common policy pillar elements. It moves the code from the policy manager and creates helpers function in the collection. It also factorize the RoutingStrategy structure within a separated header file. Change-Id: I29964ff77564fadedf3237c8754240b21ae77297 Signed-off-by: François Gaffie --- .../managerdefault/AudioPolicyManager.h | 48 +++++++++------------- 1 file changed, 19 insertions(+), 29 deletions(-) (limited to 'services/audiopolicy/managerdefault/AudioPolicyManager.h') diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h index 6b70f2e..79add3b 100644 --- a/services/audiopolicy/managerdefault/AudioPolicyManager.h +++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h @@ -37,6 +37,7 @@ #include #include #include +#include namespace android { @@ -158,8 +159,14 @@ public: uint32_t strategy, int session, int id); - virtual status_t unregisterEffect(int id); - virtual status_t setEffectEnabled(int id, bool enabled); + virtual status_t unregisterEffect(int id) + { + return mEffects.unregisterEffect(id); + } + virtual status_t setEffectEnabled(int id, bool enabled) + { + return mEffects.setEffectEnabled(id, enabled); + } virtual bool isStreamActive(audio_stream_type_t stream, uint32_t inPastMs = 0) const { @@ -213,20 +220,6 @@ public: // return the strategy corresponding to a given stream type static routing_strategy getStrategy(audio_stream_type_t stream); protected: - - class EffectDescriptor : public RefBase - { - public: - - status_t dump(int fd); - - int mIo; // io the effect is attached to - routing_strategy mStrategy; // routing strategy the effect is associated to - int mSession; // audio session the effect is on - effect_descriptor_t mDesc; // effect descriptor - bool mEnabled; // enabled state: CPU load being used or not - }; - void addOutput(audio_io_handle_t output, sp outputDesc); void removeOutput(audio_io_handle_t output); void addInput(audio_io_handle_t input, sp inputDesc); @@ -357,16 +350,21 @@ protected: // selects the most appropriate device on input for current state audio_devices_t getNewInputDevice(audio_io_handle_t input); - virtual uint32_t getMaxEffectsCpuLoad(); - virtual uint32_t getMaxEffectsMemory(); + virtual uint32_t getMaxEffectsCpuLoad() + { + return mEffects.getMaxEffectsCpuLoad(); + } + + virtual uint32_t getMaxEffectsMemory() + { + return mEffects.getMaxEffectsMemory(); + } #ifdef AUDIO_POLICY_TEST virtual bool threadLoop(); void exit(); int testOutputIndex(audio_io_handle_t output); #endif //AUDIO_POLICY_TEST - status_t setEffectEnabled(const sp& effectDesc, bool enabled); - SortedVector getOutputsForDevice(audio_devices_t device, AudioOutputCollection openOutputs); bool vectorsEqual(SortedVector& outputs1, @@ -398,8 +396,6 @@ protected: audio_io_handle_t selectOutputForEffects(const SortedVector& outputs); - bool isNonOffloadableEffectEnabled(); - virtual status_t addAudioPatch(audio_patch_handle_t handle, const sp& patch) { return mAudioPatches.addAudioPatch(handle, patch); @@ -440,13 +436,7 @@ protected: audio_devices_t mDeviceForStrategy[NUM_STRATEGIES]; float mLastVoiceVolume; // last voice volume value sent to audio HAL - // Maximum CPU load allocated to audio effects in 0.1 MIPS (ARMv5TE, 0 WS memory) units - static const uint32_t MAX_EFFECTS_CPU_LOAD = 1000; - // Maximum memory allocated to audio effects in KB - static const uint32_t MAX_EFFECTS_MEMORY = 512; - uint32_t mTotalEffectsCpuLoad; // current CPU load used by effects - uint32_t mTotalEffectsMemory; // current memory used by effects - KeyedVector > mEffects; // list of registered audio effects + EffectDescriptorCollection mEffects; // list of registered audio effects bool mA2dpSuspended; // true if A2DP output is suspended sp mDefaultOutputDevice; // output device selected by default at boot time bool mSpeakerDrcEnabled;// true on devices that use DRC on the DEVICE_CATEGORY_SPEAKER path -- cgit v1.1