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>