summaryrefslogtreecommitdiff
path: root/audio/effect/all-versions/default/EffectsFactory.cpp
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2019-11-13 13:47:50 -0800
committerEric Laurent <elaurent@google.com>2020-01-10 11:16:32 -0800
commitd33e6935e0cdd8572fa29cf0a2741da9a67680c1 (patch)
tree5172be5d4edf96f745ce50670488a0cf047bf8fc /audio/effect/all-versions/default/EffectsFactory.cpp
parent5f9bb1b0278357258621dcfde20e2edf2e01f4b3 (diff)
Audio effect HAL: Add device ID to createEffect API
Add the possibility to specify a target audio device when creating an audio effect by passing its audio port handle to createEffect API. To attach an effect to a device, the framework will use session ID AudioSessionConsts.DEVICE and provide a valid AudioPortHandle as device ID. Bug: 136294538 Test: make Change-Id: Ic697eeafbd5df6800ad4c7fd9e0698e3d8e3beae Merged-In: Ic697eeafbd5df6800ad4c7fd9e0698e3d8e3beae
Diffstat (limited to 'audio/effect/all-versions/default/EffectsFactory.cpp')
-rw-r--r--audio/effect/all-versions/default/EffectsFactory.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/audio/effect/all-versions/default/EffectsFactory.cpp b/audio/effect/all-versions/default/EffectsFactory.cpp
index 6283e7bc13..acce7deaad 100644
--- a/audio/effect/all-versions/default/EffectsFactory.cpp
+++ b/audio/effect/all-versions/default/EffectsFactory.cpp
@@ -133,9 +133,9 @@ exit:
return Void();
}
-Return<void> EffectsFactory::getDescriptor(const Uuid& uid, getDescriptor_cb _hidl_cb) {
+Return<void> EffectsFactory::getDescriptor(const Uuid& uuid, getDescriptor_cb _hidl_cb) {
effect_uuid_t halUuid;
- HidlUtils::uuidToHal(uid, &halUuid);
+ HidlUtils::uuidToHal(uuid, &halUuid);
effect_descriptor_t halDescriptor;
status_t status = EffectGetDescriptor(&halUuid, &halDescriptor);
EffectDescriptor descriptor;
@@ -154,13 +154,31 @@ Return<void> EffectsFactory::getDescriptor(const Uuid& uid, getDescriptor_cb _hi
return Void();
}
-Return<void> EffectsFactory::createEffect(const Uuid& uid, int32_t session, int32_t ioHandle,
- createEffect_cb _hidl_cb) {
+#if MAJOR_VERSION <= 5
+Return<void> EffectsFactory::createEffect(const Uuid& uuid, int32_t session, int32_t ioHandle,
+ EffectsFactory::createEffect_cb _hidl_cb) {
+ return createEffectImpl(uuid, session, ioHandle, AUDIO_PORT_HANDLE_NONE, _hidl_cb);
+}
+#else
+Return<void> EffectsFactory::createEffect(const Uuid& uuid, int32_t session, int32_t ioHandle,
+ int32_t device,
+ EffectsFactory::createEffect_cb _hidl_cb) {
+ return createEffectImpl(uuid, session, ioHandle, device, _hidl_cb);
+}
+#endif
+
+Return<void> EffectsFactory::createEffectImpl(const Uuid& uuid, int32_t session, int32_t ioHandle,
+ int32_t device, createEffect_cb _hidl_cb) {
effect_uuid_t halUuid;
- HidlUtils::uuidToHal(uid, &halUuid);
+ HidlUtils::uuidToHal(uuid, &halUuid);
effect_handle_t handle;
Result retval(Result::OK);
- status_t status = EffectCreate(&halUuid, session, ioHandle, &handle);
+ status_t status;
+ if (session == AUDIO_SESSION_DEVICE) {
+ status = EffectCreateOnDevice(&halUuid, device, ioHandle, &handle);
+ } else {
+ status = EffectCreate(&halUuid, session, ioHandle, &handle);
+ }
sp<IEffect> effect;
uint64_t effectId = EffectMap::INVALID_ID;
if (status == OK) {