summaryrefslogtreecommitdiffstats
path: root/media/libeffects/lvm/wrapper/Bundle
diff options
context:
space:
mode:
Diffstat (limited to 'media/libeffects/lvm/wrapper/Bundle')
-rw-r--r--media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp12
-rw-r--r--media/libeffects/lvm/wrapper/Bundle/EffectBundle.h2
2 files changed, 6 insertions, 8 deletions
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index e86ed99..90756d0 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -65,6 +65,7 @@ namespace {
int LvmInitFlag = LVM_FALSE;
int LvmSessionsActive = 0;
SessionContext GlobalSessionMemory[LVM_MAX_SESSIONS];
+
int SessionIndex[LVM_MAX_SESSIONS];
// NXP SW BassBoost UUID
@@ -199,11 +200,6 @@ extern "C" int EffectCreate(effect_uuid_t *uuid,
return -EINVAL;
}
- if(sessionId < 0){
- LOGV("\tLVM_ERROR : EffectCreate sessionId is less than 0");
- return -EINVAL;
- }
-
if(LvmInitFlag == LVM_FALSE){
LvmInitFlag = LVM_TRUE;
LOGV("\tEffectCreate - Initializing all global memory");
@@ -214,7 +210,7 @@ extern "C" int EffectCreate(effect_uuid_t *uuid,
// Find next available sessionNo
for(i=0; i<LVM_MAX_SESSIONS; i++){
- if((SessionIndex[i] == -1)||(SessionIndex[i] == sessionId)){
+ if((SessionIndex[i] == LVM_UNUSED_SESSION)||(SessionIndex[i] == sessionId)){
sessionNo = i;
SessionIndex[i] = sessionId;
LOGV("\tEffectCreate: Allocating SessionNo %d for SessionId %d\n", sessionNo,sessionId);
@@ -398,7 +394,7 @@ extern "C" int EffectRelease(effect_interface_t interface){
// Clear the SessionIndex
for(int i=0; i<LVM_MAX_SESSIONS; i++){
if(SessionIndex[i] == pContext->pBundledContext->SessionId){
- SessionIndex[i] = -1;
+ SessionIndex[i] = LVM_UNUSED_SESSION;
LOGV("\tEffectRelease: Clearing SessionIndex SessionNo %d for SessionId %d\n",
i, pContext->pBundledContext->SessionId);
break;
@@ -432,7 +428,7 @@ void LvmGlobalBundle_init(){
GlobalSessionMemory[i].bVirtualizerInstantiated = LVM_FALSE;
GlobalSessionMemory[i].pBundledContext = LVM_NULL;
- SessionIndex[i] = -1;
+ SessionIndex[i] = LVM_UNUSED_SESSION;
}
return;
}
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
index 35e1114..91963af 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
@@ -21,6 +21,7 @@
#include <media/EffectBassBoostApi.h>
#include <media/EffectVirtualizerApi.h>
#include <LVM.h>
+#include <limits.h>
#if __cplusplus
extern "C" {
@@ -30,6 +31,7 @@ extern "C" {
#define MAX_NUM_BANDS 5
#define MAX_CALL_SIZE 256
#define LVM_MAX_SESSIONS 32
+#define LVM_UNUSED_SESSION INT_MAX
#define BASS_BOOST_CUP_LOAD_ARM9E 150 // Expressed in 0.1 MIPS
#define VIRTUALIZER_CUP_LOAD_ARM9E 120 // Expressed in 0.1 MIPS
#define EQUALIZER_CUP_LOAD_ARM9E 220 // Expressed in 0.1 MIPS