HAL: Restrict calls to ADM for low-latency and ultra low-latency usecase
Stream must be registered for AUDIO_OUTPUT_FLAG_FAST and AUDIO_INPUT_FLAG_FAST.
The others are not intended to take this path. If all streams are registered,
they wait for focus which leads to underruns.
Added extra condition for ultra low latency usecase (AUDIO_OUTPUT_FLAG_RAW and
AUDIO_INPUT_FLAG_RAW) to avoid delay.
Change-Id: Ib8886d83e33aa0e8aa7bae1bec6472b4381557bf
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index edec6b9..79e52ed 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -3320,7 +3320,7 @@
in->pcm = NULL;
goto error_open;
}
- if (in->flags == AUDIO_INPUT_FLAG_FAST)
+ if (in->flags & (AUDIO_INPUT_FLAG_FAST | AUDIO_INPUT_FLAG_RAW))
register_in_stream(in);
if (in->realtime) {
ATRACE_BEGIN("pcm_in_start");
@@ -4175,7 +4175,7 @@
}
if (ret == 0) {
- if (out->flags == AUDIO_OUTPUT_FLAG_FAST)
+ if (out->flags & (AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_RAW))
register_out_stream(out);
if (out->realtime) {
if (out->pcm == NULL || !pcm_is_ready(out->pcm)) {