Refine EffectProxy logic
To allow create multiple EffectProxy instances for same type
Implement dump with all sub-effects
Bug: 271500140
Test: Enable AIDL and flash to pixel
Test: Play Youtube music with effect on/off
Test: dumpsys media.audio_flinger
Change-Id: I468d7e8712d7b098d869f147a4b40881ef11cabb
Merged-In: I468d7e8712d7b098d869f147a4b40881ef11cabb
diff --git a/media/libaudiohal/impl/EffectsFactoryHalAidl.h b/media/libaudiohal/impl/EffectsFactoryHalAidl.h
index 39beea2..b900cb4 100644
--- a/media/libaudiohal/impl/EffectsFactoryHalAidl.h
+++ b/media/libaudiohal/impl/EffectsFactoryHalAidl.h
@@ -17,6 +17,7 @@
#pragma once
#include <cstddef>
+#include <list>
#include <memory>
#include <mutex>
@@ -72,10 +73,9 @@
const detail::AudioHalVersionInfo mHalVersion;
// Full list of HAL effect descriptors
const std::vector<Descriptor> mHalDescList;
- // Map of proxy UUID (key) to the proxy object
- const std::map<::aidl::android::media::audio::common::AudioUuid /* proxy impl UUID */,
- std::shared_ptr<EffectProxy>>
- mUuidProxyMap;
+ // Map of proxy UUID (key) to the Descriptor of sub-effects
+ const std::map<::aidl::android::media::audio::common::AudioUuid, std::vector<Descriptor>>
+ mProxyUuidDescriptorMap;
// List of effect proxy, initialize after mUuidProxyMap because it need to have all sub-effects
const std::vector<Descriptor> mProxyDescList;
// List of non-proxy effects
@@ -85,16 +85,19 @@
// Query result of pre and post processing from effect factory
const std::vector<Processing> mAidlProcessings;
+ // list of the EffectProxy instances
+ std::list<std::shared_ptr<EffectProxy>> mProxyList;
+
std::mutex mLock;
uint64_t mEffectIdCounter GUARDED_BY(mLock) = 0; // Align with HIDL (0 is INVALID_ID)
virtual ~EffectsFactoryHalAidl() = default;
status_t getHalDescriptorWithImplUuid(
- const aidl::android::media::audio::common::AudioUuid& uuid,
+ const ::aidl::android::media::audio::common::AudioUuid& uuid,
effect_descriptor_t* pDescriptor);
status_t getHalDescriptorWithTypeUuid(
- const aidl::android::media::audio::common::AudioUuid& type,
+ const ::aidl::android::media::audio::common::AudioUuid& type,
std::vector<effect_descriptor_t>* descriptors);
bool isProxyEffect(const aidl::android::media::audio::common::AudioUuid& uuid) const;