hal: compilation fix for extended feature flags
- Fix compilation error for offload, Dolby,
HDMI pass through, FLAC decoder, and hardware
accelerated effects when extended feature
flags are disabled.
Change-Id: If64d5fa5d124b42d40d7e123b887db8e0a5d7426
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index 3e38d2b..523a875 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -46,6 +46,9 @@
#define AUDIO_FORMAT_PCM_24_BIT_OFFLOAD (AUDIO_FORMAT_PCM_OFFLOAD | AUDIO_FORMAT_PCM_SUB_8_24_BIT)
#define AUDIO_OFFLOAD_CODEC_FORMAT "music_offload_codec_format"
#define audio_is_offload_pcm(format) (0)
+#define OFFLOAD_USE_SMALL_BUFFER false
+#else
+#define OFFLOAD_USE_SMALL_BUFFER (info->use_small_bufs)
#endif
#ifndef AFE_PROXY_ENABLED
@@ -314,6 +317,9 @@
void audio_extn_dolby_set_dmid(struct audio_device *adev);
#else
#define audio_extn_dolby_set_dmid(adev) (0)
+#define AUDIO_CHANNEL_OUT_PENTA (AUDIO_CHANNEL_OUT_QUAD | AUDIO_CHANNEL_OUT_FRONT_CENTER)
+#define AUDIO_CHANNEL_OUT_SURROUND (AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | \
+ AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_BACK_CENTER)
#endif
@@ -360,6 +366,7 @@
#define audio_extn_dolby_get_passt_buffer_size(info) (0)
#define audio_extn_dolby_set_passt_volume(out, mute) (0)
#define audio_extn_dolby_set_passt_latency(out, latency) (0)
+#define AUDIO_OUTPUT_FLAG_COMPRESS_PASSTHROUGH 0x4000
#else
int audio_extn_dolby_update_passt_formats(struct audio_device *adev,
struct stream_out *out);
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 435138d..7c3848b 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -2903,7 +2903,7 @@
if (flags & AUDIO_OUTPUT_FLAG_NON_BLOCKING)
out->non_blocking = 1;
- if (config->offload_info.use_small_bufs) {
+ if (platform_use_small_buffer(&config->offload_info)) {
//this flag is set from framework only if its for PCM formats
//no need to check for PCM format again
out->non_blocking = 0;
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index d12959d..765aea1 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -3345,7 +3345,7 @@
bits_per_sample = 32;
}
- if (info->use_small_bufs) {
+ if (platform_use_small_buffer(info)) {
pcm_offload_time = PCM_OFFLOAD_BUFFER_DURATION_FOR_SMALL_BUFFERS;
} else {
if (!info->has_video) {
@@ -3609,6 +3609,10 @@
done:
return ret;
}
+bool platform_use_small_buffer(audio_offload_info_t* info)
+{
+ return OFFLOAD_USE_SMALL_BUFFER;
+}
void platform_get_device_to_be_id_map(int **device_to_be_id, int *length)
{
diff --git a/hal/msm8960/platform.c b/hal/msm8960/platform.c
index 2065b54..bceaf96 100644
--- a/hal/msm8960/platform.c
+++ b/hal/msm8960/platform.c
@@ -1107,6 +1107,11 @@
return 0;
}
+bool platform_use_small_buffer(audio_offload_info_t* info)
+{
+ return false;
+}
+
int platform_get_edid_info(void *platform __unused)
{
return -ENOSYS;
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 4f90850..461c9a2 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -3064,6 +3064,11 @@
return fragment_size;
}
+bool platform_use_small_buffer(audio_offload_info_t* info)
+{
+ return OFFLOAD_USE_SMALL_BUFFER;
+}
+
int platform_set_codec_backend_cfg(struct audio_device* adev,
unsigned int bit_width, unsigned int sample_rate)
{
diff --git a/hal/platform_api.h b/hal/platform_api.h
index 2f9af6c..b2a0ccc 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -89,6 +89,7 @@
struct audio_offload_info_t;
uint32_t platform_get_compress_offload_buffer_size(audio_offload_info_t* info);
uint32_t platform_get_pcm_offload_buffer_size(audio_offload_info_t* info);
+bool platform_use_small_buffer(audio_offload_info_t* info);
uint32_t platform_get_compress_passthrough_buffer_size(audio_offload_info_t* info);
bool platform_check_and_set_codec_backend_cfg(struct audio_device* adev, struct audio_usecase *usecase);
diff --git a/hal/voice.c b/hal/voice.c
index 9fc1081..c00df1a 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -22,6 +22,7 @@
#define LOG_NDDEBUG 0
#include <errno.h>
+#include <stdlib.h>
#include <math.h>
#include <cutils/log.h>
#include <cutils/str_parms.h>
diff --git a/post_proc/Android.mk b/post_proc/Android.mk
index be70166..ed46f17 100644
--- a/post_proc/Android.mk
+++ b/post_proc/Android.mk
@@ -14,8 +14,12 @@
virtualizer.c \
reverb.c \
effect_api.c \
- effect_util.c \
- hw_accelerator.c
+ effect_util.c
+
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_HW_ACCELERATED_EFFECTS)),true)
+ LOCAL_CFLAGS += -DHW_ACCELERATED_EFFECTS
+ LOCAL_SRC_FILES += hw_accelerator.c
+endif
LOCAL_CFLAGS+= -O2 -fvisibility=hidden
diff --git a/post_proc/bundle.c b/post_proc/bundle.c
index e38a41c..c09d2ad 100644
--- a/post_proc/bundle.c
+++ b/post_proc/bundle.c
@@ -43,7 +43,7 @@
#include <system/thread_defs.h>
#include <tinyalsa/asoundlib.h>
#include <hardware/audio_effect.h>
-
+#include <stdlib.h>
#include "bundle.h"
#include "hw_accelerator.h"
#include "equalizer.h"
@@ -69,7 +69,9 @@
&ins_env_reverb_descriptor,
&aux_preset_reverb_descriptor,
&ins_preset_reverb_descriptor,
+#ifdef HW_ACCELERATED_EFFECTS
&hw_accelerator_descriptor,
+#endif
NULL,
};
@@ -604,6 +606,7 @@
reverb_preset_init(reverb_ctxt);
}
reverb_ctxt->ctl = NULL;
+#ifdef HW_ACCELERATED_EFFECTS
} else if (memcmp(uuid, &hw_accelerator_descriptor.uuid,
sizeof(effect_uuid_t)) == 0) {
hw_accelerator_context_t *hw_acc_ctxt = (hw_accelerator_context_t *)
@@ -625,6 +628,7 @@
context->ops.process = hw_accelerator_process;
context->desc = &hw_accelerator_descriptor;
+#endif
} else {
return -EINVAL;
}
@@ -910,7 +914,7 @@
add_effect_to_output(out_ctxt, context);
} break;
-
+#ifdef HW_ACCELERATED_EFFECTS
case EFFECT_CMD_HW_ACC: {
ALOGV("EFFECT_CMD_HW_ACC cmdSize %d pCmdData %p, *replySize %d, pReplyData %p",
cmdSize, pCmdData, *replySize, pReplyData);
@@ -925,6 +929,7 @@
context->hw_acc_enabled = (value > 0) ? true : false;
break;
}
+#endif
default:
if (cmdCode >= EFFECT_CMD_FIRST_PROPRIETARY && context->ops.command)
status = context->ops.command(context, cmdCode, cmdSize,
diff --git a/post_proc/bundle.h b/post_proc/bundle.h
index 06da991..efe69ee 100644
--- a/post_proc/bundle.h
+++ b/post_proc/bundle.h
@@ -27,7 +27,9 @@
/* Retry for delay for mixer open */
#define RETRY_NUMBER 10
#define RETRY_US 500000
-
+#ifdef HW_ACCELERATED_EFFECTS
+#define EFFECT_CMD_HW_ACC 20
+#endif
#define MIXER_CARD 0
#define SOUND_CARD 0
diff --git a/post_proc/effect_api.c b/post_proc/effect_api.c
index 2fb79ed..7aef997 100644
--- a/post_proc/effect_api.c
+++ b/post_proc/effect_api.c
@@ -60,7 +60,7 @@
#include <sound/audio_effects.h>
#include <sound/devdep_params.h>
#include <linux/msm_audio.h>
-
+#include <errno.h>
#include "effect_api.h"
#ifdef DTS_EAGLE
diff --git a/post_proc/effect_util.c b/post_proc/effect_util.c
index 8f7a604..b401f6a 100644
--- a/post_proc/effect_util.c
+++ b/post_proc/effect_util.c
@@ -17,6 +17,7 @@
#include <utils/Log.h>
#include <stdlib.h>
#include "effect_util.h"
+#include <string.h>
#ifdef LOG_TAG
#undef LOG_TAG
diff --git a/voice_processing/voice_processing.c b/voice_processing/voice_processing.c
index 1d18a3d..bb9bf3b 100644
--- a/voice_processing/voice_processing.c
+++ b/voice_processing/voice_processing.c
@@ -17,6 +17,7 @@
#define LOG_TAG "voice_processing"
/*#define LOG_NDEBUG 0*/
#include <dlfcn.h>
+#include <stdlib.h>
#include <cutils/log.h>
#include <cutils/list.h>
#include <hardware/audio_effect.h>