hal: Add support for FAST FLAG in compress path
Add support for FAST FLAG in capture path.
Clients may request to open the compress session
in perf mode by passing the FAST FLAG.
Change-Id: I2b6cc50b0dd45aa6d6d78362392e4ee39dddd967
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index 97b7688..a172ce4 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -1096,6 +1096,7 @@
int audio_extn_utils_pcm_get_dsp_presentation_pos(struct stream_out *out,
uint64_t *frames, struct timespec *timestamp, int32_t clock_id);
size_t audio_extn_utils_get_input_buffer_size(uint32_t, audio_format_t, int, int64_t, bool);
+int audio_extn_utils_get_perf_mode_flag(void);
#ifdef AUDIO_HW_LOOPBACK_ENABLED
/* API to create audio patch */
int audio_extn_hw_loopback_create_audio_patch(struct audio_hw_device *dev,
diff --git a/hal/audio_extn/compress_in.c b/hal/audio_extn/compress_in.c
index bc630a3..6b525b0 100644
--- a/hal/audio_extn/compress_in.c
+++ b/hal/audio_extn/compress_in.c
@@ -332,6 +332,11 @@
else
cin_data->compr_config.codec->compr_passthr = PASSTHROUGH_GEN;
+ if (in->flags & AUDIO_INPUT_FLAG_FAST) {
+ ALOGD("%s: Setting latency mode to true", __func__);
+ cin_data->compr_config.codec->flags |= audio_extn_utils_get_perf_mode_flag();
+ }
+
if ((in->flags & AUDIO_INPUT_FLAG_TIMESTAMP) ||
(in->flags & AUDIO_INPUT_FLAG_PASSTHROUGH)) {
compress_config_set_timstamp_flag(&cin_data->compr_config);
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index 8d9cd33..30bc10d 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -2949,6 +2949,15 @@
return is_running_with_enhanced_fwk;
}
+int audio_extn_utils_get_perf_mode_flag(void)
+{
+#ifdef COMPRESSED_PERF_MODE_FLAG
+ return COMPRESSED_PERF_MODE_FLAG;
+#else
+ return 0;
+#endif
+}
+
size_t audio_extn_utils_get_input_buffer_size(uint32_t sample_rate,
audio_format_t format,
int channel_count,
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 7519ee7..d62c4cf 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -7380,6 +7380,11 @@
ALOGV("non-offload DIRECT_usecase ... usecase selected %d ", out->usecase);
}
+ if (out->flags & AUDIO_OUTPUT_FLAG_FAST) {
+ ALOGD("%s: Setting latency mode to true", __func__);
+ out->compr_config.codec->flags |= audio_extn_utils_get_perf_mode_flag();
+ }
+
if (out->usecase == USECASE_INVALID) {
if (out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL &&
config->format == 0 && config->sample_rate == 0 &&
@@ -8713,6 +8718,8 @@
}
if (config->sample_rate == LOW_LATENCY_CAPTURE_SAMPLE_RATE &&
+ (flags & AUDIO_INPUT_FLAG_TIMESTAMP) == 0 &&
+ (flags & AUDIO_INPUT_FLAG_COMPRESS) == 0 &&
(flags & AUDIO_INPUT_FLAG_FAST) != 0) {
is_low_latency = true;
#if LOW_LATENCY_CAPTURE_USE_CASE