hal: add support to use low lantecy as primay output
- Add support to use low lantency output as primary
output when AUDIO_USE_LL_AS_PRIMARY_OUTPUT is enabled
Change-Id: Ie7faf9f7af4c97b7afdda8084b7acf162abbc0b6
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 96f252c..607258d 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -81,7 +81,13 @@
#define PROXY_OPEN_RETRY_COUNT 100
#define PROXY_OPEN_WAIT_TIME 20
+#ifdef USE_LL_AS_PRIMARY_OUTPUT
+#define USECASE_AUDIO_PLAYBACK_PRIMARY USECASE_AUDIO_PLAYBACK_LOW_LATENCY
+#define PCM_CONFIG_AUDIO_PLAYBACK_PRIMARY pcm_config_low_latency
+#else
#define USECASE_AUDIO_PLAYBACK_PRIMARY USECASE_AUDIO_PLAYBACK_DEEP_BUFFER
+#define PCM_CONFIG_AUDIO_PLAYBACK_PRIMARY pcm_config_deep_buffer
+#endif
static unsigned int configured_low_latency_capture_period_size =
LOW_LATENCY_CAPTURE_PERIOD_SIZE;
@@ -2940,11 +2946,16 @@
out->usecase = USECASE_AUDIO_PLAYBACK_LOW_LATENCY;
out->config = pcm_config_low_latency;
out->sample_rate = out->config.rate;
+ } else if (out->flags & AUDIO_OUTPUT_FLAG_DEEP_BUFFER) {
+ format = AUDIO_FORMAT_PCM_16_BIT;
+ out->usecase = USECASE_AUDIO_PLAYBACK_DEEP_BUFFER;
+ out->config = pcm_config_deep_buffer;
+ out->sample_rate = out->config.rate;
} else {
/* primary path is the default path selected if no other outputs are available/suitable */
format = AUDIO_FORMAT_PCM_16_BIT;
out->usecase = USECASE_AUDIO_PLAYBACK_PRIMARY;
- out->config = pcm_config_deep_buffer;
+ out->config = PCM_CONFIG_AUDIO_PLAYBACK_PRIMARY;
out->sample_rate = out->config.rate;
}