summaryrefslogtreecommitdiffstats
path: root/media/libeffects
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2014-08-07 20:26:57 -0700
committerEric Laurent <elaurent@google.com>2014-08-08 08:50:15 -0700
commita5309e5c2a7a02852d2a0db7ada89a2eacb047d0 (patch)
treefe272ffbcea53bf6b1996f5c5486fc60cedcfe6d /media/libeffects
parent5d166509fa0cdf0e4b3037d7e05005a5390aedd3 (diff)
downloadframeworks_av-a5309e5c2a7a02852d2a0db7ada89a2eacb047d0.zip
frameworks_av-a5309e5c2a7a02852d2a0db7ada89a2eacb047d0.tar.gz
frameworks_av-a5309e5c2a7a02852d2a0db7ada89a2eacb047d0.tar.bz2
Enable loading of 64 bit effect libraries
Change-Id: I19252ea8d7dd8b9eee2532059c5a3a98d53c3b28
Diffstat (limited to 'media/libeffects')
-rw-r--r--media/libeffects/factory/EffectsFactory.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/media/libeffects/factory/EffectsFactory.c b/media/libeffects/factory/EffectsFactory.c
index 6d30d64..5bfe508 100644
--- a/media/libeffects/factory/EffectsFactory.c
+++ b/media/libeffects/factory/EffectsFactory.c
@@ -503,15 +503,31 @@ int loadLibrary(cnode *root, const char *name)
audio_effect_library_t *desc;
list_elem_t *e;
lib_entry_t *l;
+ char path[PATH_MAX];
+ char *str;
+ size_t len;
node = config_find(root, PATH_TAG);
if (node == NULL) {
return -EINVAL;
}
+ // audio_effects.conf always specifies 32 bit lib path: convert to 64 bit path if needed
+ strlcpy(path, node->value, PATH_MAX);
+#ifdef __LP64__
+ str = strstr(path, "/lib/");
+ if (str == NULL)
+ return -EINVAL;
+ len = str - path;
+ path[len] = '\0';
+ strlcat(path, "/lib64/", PATH_MAX);
+ strlcat(path, node->value + len + strlen("/lib/"), PATH_MAX);
+#endif
+ if (strlen(path) >= PATH_MAX - 1)
+ return -EINVAL;
- hdl = dlopen(node->value, RTLD_NOW);
+ hdl = dlopen(path, RTLD_NOW);
if (hdl == NULL) {
- ALOGW("loadLibrary() failed to open %s", node->value);
+ ALOGW("loadLibrary() failed to open %s", path);
goto error;
}
@@ -535,7 +551,7 @@ int loadLibrary(cnode *root, const char *name)
// add entry for library in gLibraryList
l = malloc(sizeof(lib_entry_t));
l->name = strndup(name, PATH_MAX);
- l->path = strndup(node->value, PATH_MAX);
+ l->path = strndup(path, PATH_MAX);
l->handle = hdl;
l->desc = desc;
l->effects = NULL;
@@ -547,7 +563,7 @@ int loadLibrary(cnode *root, const char *name)
e->next = gLibraryList;
gLibraryList = e;
pthread_mutex_unlock(&gLibLock);
- ALOGV("getLibrary() linked library %p for path %s", l, node->value);
+ ALOGV("getLibrary() linked library %p for path %s", l, path);
return 0;