hal: support car audio stream for bus devices
Add support for car audio streams and usecases
including media, system notification, navigation
guidance and phone.
The car audio streams are routed to bus devices
with assigned address, which is defined in audio
policy configuration. This enables dynamic mixing
and routing done by Android car framework from
application to AudioFlinger and audio HAL.
Change-Id: I583fc7b5f2e8850b064a3cde5f93693b16c47841
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 9a93ed7..12312cc 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -222,6 +222,12 @@
USECASE_AUDIO_A2DP_ABR_FEEDBACK,
+ /* car streams usecases */
+ USECASE_AUDIO_PLAYBACK_MEDIA,
+ USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION,
+ USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE,
+ USECASE_AUDIO_PLAYBACK_PHONE,
+
AUDIO_USECASE_MAX
};
@@ -290,6 +296,21 @@
RENDER_MODE_AUDIO_STC_MASTER,
} render_mode_t;
+#ifdef AUDIO_EXTN_AUTO_HAL_ENABLED
+/* This defines the physical car streams supported in audio HAL,
+ * limited by the available frontend PCM driver.
+ * Max number of physical streams supported is currently 8 and is
+ * represented by stream bit flag as indicated in vehicle HAL interface.
+ */
+#define MAX_CAR_AUDIO_STREAMS 8
+enum {
+ CAR_AUDIO_STREAM_MEDIA = 0x1,
+ CAR_AUDIO_STREAM_SYS_NOTIFICATION = 0x2,
+ CAR_AUDIO_STREAM_NAV_GUIDANCE = 0x4,
+ CAR_AUDIO_STREAM_PHONE = 0x8,
+};
+#endif
+
struct stream_app_type_cfg {
int sample_rate;
uint32_t bit_width;
@@ -407,6 +428,9 @@
error_log_t *error_log;
bool pspd_coeff_sent;
+
+ char address[AUDIO_DEVICE_MAX_ADDRESS_LEN];
+ int car_audio_stream;
};
struct stream_in {
@@ -694,6 +718,11 @@
streams_output_ctxt_t *out_get_stream(struct audio_device *dev,
audio_io_handle_t output);
+size_t get_output_period_size(uint32_t sample_rate,
+ audio_format_t format,
+ int channel_count,
+ int duration /*in millisecs*/);
+
#define LITERAL_TO_STRING(x) #x
#define CHECK(condition) LOG_ALWAYS_FATAL_IF(!(condition), "%s",\
__FILE__ ":" LITERAL_TO_STRING(__LINE__)\