hal: Add property to set TrueHD buffer size
Add the property audio.truehd.buffer.size.kb to
allow users to set the TrueHD buffer size to
a value other than the default of 2kb. TrueHD
is supported only for compress pass-through
and can be set as IEC format audio.
Change-Id: I97698eb84c7f6fe94219771650654204c203be55
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 935bae3..ed6b712 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -6327,9 +6327,18 @@
audio_offload_info_t* info)
{
uint32_t fragment_size = MIN_COMPRESS_PASSTHROUGH_FRAGMENT_SIZE;
+ char value[PROPERTY_VALUE_MAX] = {0};
+
+ if (((info->format == AUDIO_FORMAT_DOLBY_TRUEHD) ||
+ (info->format == AUDIO_FORMAT_IEC61937)) &&
+ property_get("audio.truehd.buffer.size.kb", value, "") &&
+ atoi(value)) {
+ fragment_size = atoi(value) * 1024;
+ goto done;
+ }
if (!info->has_video)
fragment_size = MIN_COMPRESS_PASSTHROUGH_FRAGMENT_SIZE;
-
+done:
return fragment_size;
}
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 1d32409..88763ee 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -5996,9 +5996,18 @@
audio_offload_info_t* info)
{
uint32_t fragment_size = MIN_COMPRESS_PASSTHROUGH_FRAGMENT_SIZE;
+ char value[PROPERTY_VALUE_MAX] = {0};
+
+ if (((info->format == AUDIO_FORMAT_DOLBY_TRUEHD) ||
+ (info->format == AUDIO_FORMAT_IEC61937)) &&
+ property_get("audio.truehd.buffer.size.kb", value, "") &&
+ atoi(value)) {
+ fragment_size = atoi(value) * 1024;
+ goto done;
+ }
if (!info->has_video)
fragment_size = MIN_COMPRESS_PASSTHROUGH_FRAGMENT_SIZE;
-
+done:
return fragment_size;
}