audio: hal: Add support to configure render mode
-Changes to configure render mode
Change-Id: I38ef63bf89eaf7a8664ff33cd00455b9643a4cdc
CRs-Fixed: 2009985
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index aa26626..07cba28 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -93,6 +93,10 @@
AUDIO_FORMAT_AAC_SUB_HE_V2)
#endif
+#ifndef AUDIO_OUTPUT_FLAG_TIMESTAMP
+#define AUDIO_OUTPUT_FLAG_TIMESTAMP 0x10000
+#endif
+
#ifndef COMPRESS_METADATA_NEEDED
#define audio_extn_parse_compress_metadata(out, parms) (0)
#else
@@ -829,4 +833,5 @@
struct audio_usecase *usecase,
struct audio_avt_device_drift_param *drift_param);
int audio_extn_utils_compress_get_dsp_latency(struct stream_out *out);
+int audio_extn_utils_compress_set_render_mode(struct stream_out *out);
#endif /* AUDIO_EXTN_H */
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index 349d2b0..7860522 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -1694,3 +1694,46 @@
return COMPRESS_OFFLOAD_PLAYBACK_LATENCY;
}
#endif
+
+#ifdef SNDRV_COMPRESS_RENDER_MODE
+int audio_extn_utils_compress_set_render_mode(struct stream_out *out)
+{
+ struct snd_compr_metadata metadata;
+ int ret = -EINVAL;
+
+ if (!(is_offload_usecase(out->usecase))) {
+ ALOGE("%s:: not supported for non offload session", __func__);
+ goto exit;
+ }
+
+ if (!out->compr) {
+ ALOGD("%s:: Invalid compress handle",
+ __func__);
+ goto exit;
+ }
+
+ ALOGD("%s:: render mode %d", __func__, out->render_mode);
+
+ metadata.key = SNDRV_COMPRESS_RENDER_MODE;
+ if (out->render_mode == RENDER_MODE_AUDIO_MASTER) {
+ metadata.value[0] = SNDRV_COMPRESS_RENDER_MODE_AUDIO_MASTER;
+ } else if (out->render_mode == RENDER_MODE_AUDIO_STC_MASTER) {
+ metadata.value[0] = SNDRV_COMPRESS_RENDER_MODE_STC_MASTER;
+ } else {
+ ret = 0;
+ goto exit;
+ }
+ ret = compress_set_metadata(out->compr, &metadata);
+ if(ret) {
+ ALOGE("%s::error %s", __func__, compress_get_error(out->compr));
+ }
+exit:
+ return ret;
+}
+#else
+int audio_extn_utils_compress_set_render_mode(struct stream_out *out __unused)
+{
+ ALOGD("%s:: configuring render mode not supported", __func__);
+ return 0;
+}
+#endif