mm-audio: Fix delay with first voice call after bootup.
- Add csd init and deinit to HAL constructor and
destructor
- Add conditional check for voice acdb loader
Bug-id: 7612431
Change-Id: I4165e659fa300abb184e2438a5d730bb2158c094
diff --git a/alsa_sound/AudioHardwareALSA.cpp b/alsa_sound/AudioHardwareALSA.cpp
index a53f161..4050777 100644
--- a/alsa_sound/AudioHardwareALSA.cpp
+++ b/alsa_sound/AudioHardwareALSA.cpp
@@ -57,6 +57,8 @@
static void (*acdb_deallocate)();
#endif
#ifdef QCOM_CSDCLIENT_ENABLED
+ static int (*csd_client_init)();
+ static int (*csd_client_deinit)();
static int (*csd_start_playback)();
static int (*csd_stop_playback)();
#endif
@@ -128,8 +130,16 @@
ALOGE("AudioHardware: DLOPEN not successful for CSD CLIENT");
} else {
ALOGD("AudioHardware: DLOPEN successful for CSD CLIENT");
+ csd_client_init = (int (*)())::dlsym(mCsdHandle,"csd_client_init");
+ csd_client_deinit = (int (*)())::dlsym(mCsdHandle,"csd_client_deinit");
csd_start_playback = (int (*)())::dlsym(mCsdHandle,"csd_client_start_playback");
csd_stop_playback = (int (*)())::dlsym(mCsdHandle,"csd_client_stop_playback");
+
+ if (csd_client_init == NULL) {
+ ALOGE("dlsym: Error:%s Loading csd_client_init", dlerror());
+ } else {
+ csd_client_init();
+ }
}
mALSADevice->setCsdHandle(mCsdHandle);
#endif
@@ -179,6 +189,10 @@
#ifdef QCOM_ACDB_ENABLED
if (mAcdbHandle) {
mUcMgr->acdb_handle = static_cast<void*> (mAcdbHandle);
+ if (mFusion3Platform)
+ mUcMgr->isFusion3Platform = true;
+ else
+ mUcMgr->isFusion3Platform = false;
}
#endif
}
@@ -221,8 +235,13 @@
#ifdef QCOM_CSDCLEINT_ENABLED
if (mCsdHandle) {
- ::dlclose(mCsdHandle);
- mCsdHandle = NULL;
+ if (csd_client_deinit == NULL) {
+ ALOGE("dlsym: Error:%s Loading csd_client_deinit", dlerror());
+ } else {
+ csd_client_deinit();
+ }
+ ::dlclose(mCsdHandle);
+ mCsdHandle = NULL;
}
#endif
}
diff --git a/libalsa-intf/alsa_ucm.c b/libalsa-intf/alsa_ucm.c
index 3548f67..e53211f 100644
--- a/libalsa-intf/alsa_ucm.c
+++ b/libalsa-intf/alsa_ucm.c
@@ -27,7 +27,7 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define LOG_TAG "alsa_ucm"
-#define LOG_NDDEBUG 0
+//#define LOG_NDDEBUG 0
#ifdef ANDROID
/* definitions for Android logging */
@@ -673,7 +673,7 @@
ALOGD("Voice acdb: rx id %d tx id %d",
uc_mgr->current_rx_device,
uc_mgr->current_tx_device);
- if (uc_mgr->acdb_handle) {
+ if (uc_mgr->acdb_handle && !uc_mgr->isFusion3Platform) {
acdb_send_voice_cal = dlsym(uc_mgr->acdb_handle,"acdb_loader_send_voice_cal");
if (acdb_send_voice_cal == NULL) {
ALOGE("ucm: dlsym: Error:%s Loading acdb_loader_send_voice_cal", dlerror());
diff --git a/libalsa-intf/msm8960_use_cases.h b/libalsa-intf/msm8960_use_cases.h
index ed58d8a..ba8b6de 100644
--- a/libalsa-intf/msm8960_use_cases.h
+++ b/libalsa-intf/msm8960_use_cases.h
@@ -35,6 +35,7 @@
#include "alsa_ucm.h"
#include "alsa_audio.h"
+#include <stdbool.h>
#include <pthread.h>
#define SND_UCM_END_OF_LIST "end"
@@ -169,6 +170,7 @@
card_ctxt_t *card_ctxt_ptr;
pthread_t thr;
void *acdb_handle;
+ bool isFusion3Platform;
};
#define MAX_NUM_CARDS (sizeof(card_list)/sizeof(char *))