hal: Add support for APTX and AAC decoding in DSP.
Add APTX and AAC_LATM format in compress offload output profile.
Change-Id: I36668caeb89f2ee0da2b60825f610a5c2615be0b
diff --git a/configs/msm8998/msm8998.mk b/configs/msm8998/msm8998.mk
index 5f4e6e1..f39a97b 100644
--- a/configs/msm8998/msm8998.mk
+++ b/configs/msm8998/msm8998.mk
@@ -64,6 +64,7 @@
AUDIO_FEATURE_ENABLED_RAS := true
AUDIO_FEATURE_ENABLED_DYNAMIC_LOG := true
AUDIO_FEATURE_ENABLED_SND_MONITOR := true
+AUDIO_FEATURE_ENABLED_A2DP_DECODERS := true
##AUDIO_FEATURE_FLAGS
#Audio Specific device overlays
diff --git a/hal/Android.mk b/hal/Android.mk
index 9d732b2..10ce357 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -460,6 +460,10 @@
LOCAL_STATIC_LIBRARIES += libprofile_rt
endif
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_A2DP_DECODERS)), true)
+ LOCAL_CFLAGS += -DAPTX_DECODER_ENABLED
+endif
+
LOCAL_MODULE := audio.primary.$(TARGET_BOARD_PLATFORM)
LOCAL_MODULE_RELATIVE_PATH := hw
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index 20d760c..38d0b6f 100644
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -62,6 +62,16 @@
#include <log_utils.h>
#endif
+#ifndef APTX_DECODER_ENABLED
+#define audio_extn_aptx_dec_set_license(adev) (0)
+#define audio_extn_set_aptx_dec_bt_addr(adev, parms) (0)
+#define audio_extn_parse_aptx_dec_bt_addr(value) (0)
+#else
+static void audio_extn_aptx_dec_set_license(struct audio_device *adev);
+static void audio_extn_set_aptx_dec_bt_addr(struct audio_device *adev, struct str_parms *parms);
+static void audio_extn_parse_aptx_dec_bt_addr(char *value);
+#endif
+
#define MAX_SLEEP_RETRY 100
#define WIFI_INIT_WAIT_SLEEP 50
#define MAX_NUM_CHANNELS 8
@@ -1538,7 +1548,6 @@
static void audio_extn_aptx_dec_set_license(struct audio_device *adev)
{
int ret, key = 0;
- char value[128] = {0};
struct mixer_ctl *ctl;
const char *mixer_ctl_name = "APTX Dec License";
@@ -1556,7 +1565,7 @@
ALOGE("%s: cannot set license, error:%d",__func__, ret);
}
-static void audio_extn_set_aptx_dec_bt_addr(struct audio_device *adev, struct str_parms *parms)
+static void audio_extn_set_aptx_dec_bt_addr(struct audio_device *adev __unused, struct str_parms *parms)
{
int ret = 0;
char value[256];
@@ -1575,6 +1584,7 @@
aextnmod.addr.nap = aptx_cfg->bt_addr.nap;
aextnmod.addr.uap = aptx_cfg->bt_addr.uap;
aextnmod.addr.lap = aptx_cfg->bt_addr.lap;
+ return 0;
}
static void audio_extn_parse_aptx_dec_bt_addr(char *value)
@@ -1602,11 +1612,7 @@
void audio_extn_send_aptx_dec_bt_addr_to_dsp(struct stream_out *out)
{
- char mixer_ctl_name[128];
- struct mixer_ctl *ctl;
- uint32_t addr[3];
-
- ALOGV("%s", __func__);
+ ALOGD("%s", __func__);
out->compr_config.codec->options.aptx_dec.nap = aextnmod.addr.nap;
out->compr_config.codec->options.aptx_dec.uap = aextnmod.addr.uap;
out->compr_config.codec->options.aptx_dec.lap = aextnmod.addr.lap;
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index 6b08671..7087b12 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -971,16 +971,10 @@
#endif
#ifndef APTX_DECODER_ENABLED
-#define audio_extn_aptx_dec_set_license(adev); (0)
-#define audio_extn_set_aptx_dec_bt_addr(adev, parms); (0)
-#define audio_extn_send_aptx_dec_bt_addr_to_dsp(out); (0)
-#define audio_extn_parse_aptx_dec_bt_addr(value); (0)
-#define audio_extn_set_aptx_dec_params(payload); (0)
+#define audio_extn_send_aptx_dec_bt_addr_to_dsp(out) (0)
+#define audio_extn_set_aptx_dec_params(payload) (0)
#else
-static void audio_extn_aptx_dec_set_license(struct audio_device *adev);
-static void audio_extn_set_aptx_dec_bt_addr(struct audio_device *adev, struct str_parms *parms);
void audio_extn_send_aptx_dec_bt_addr_to_dsp(struct stream_out *out);
-static void audio_extn_parse_aptx_dec_bt_addr(char *value);
int audio_extn_set_aptx_dec_params(struct aptx_dec_param *payload);
#endif
int audio_extn_out_set_param_data(struct stream_out *out,