summaryrefslogtreecommitdiffstats
path: root/hal
diff options
context:
space:
mode:
authorApurupaPattapu <apurupa@codeaurora.org>2014-04-08 10:41:07 -0700
committerApurupaPattapu <apurupa@codeaurora.org>2014-04-15 15:46:36 -0700
commitb57da78a141a8f3538579d889d2ada49c350c67b (patch)
tree97094edff71be530ae364260d71f3f955b674778 /hal
parent48a220aec830cdef2f3ac06801aeb2efc61c1ad0 (diff)
downloadandroid_hardware_qcom_audio-b57da78a141a8f3538579d889d2ada49c350c67b.tar.gz
android_hardware_qcom_audio-b57da78a141a8f3538579d889d2ada49c350c67b.tar.bz2
android_hardware_qcom_audio-b57da78a141a8f3538579d889d2ada49c350c67b.zip
hal: Correct PCM offload fragment size
- Correct the fragment size to use bytes instead of bits per sample - Use 80ms as pcm offload buffer duration for video streaming usecases and 1 sec for video + audio usecases Change-Id: Iec8e24c2b158368742a55710a46da94ce5d3c170
Diffstat (limited to 'hal')
-rw-r--r--hal/msm8974/platform.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 79736a8f..5df824c4 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -50,15 +50,15 @@
#define COMPRESS_OFFLOAD_FRAGMENT_SIZE (32 * 1024)
/* Used in calculating fragment size for pcm offload */
-#define PCM_OFFLOAD_BUFFER_DURATION_FOR_AV 2000 /* 2 secs */
-#define PCM_OFFLOAD_BUFFER_DURATION_FOR_AV_STREAMING 100 /* 100 millisecs */
+#define PCM_OFFLOAD_BUFFER_DURATION_FOR_AV 1000 /* 1 sec */
+#define PCM_OFFLOAD_BUFFER_DURATION_FOR_AV_STREAMING 80 /* 80 millisecs */
/* MAX PCM fragment size cannot be increased further due
* to flinger's cblk size of 1mb,and it has to be a multiple of
* 24 - lcm of channels supported by DSP
*/
#define MAX_PCM_OFFLOAD_FRAGMENT_SIZE (240 * 1024)
-#define MIN_PCM_OFFLOAD_FRAGMENT_SIZE (32 * 1024)
+#define MIN_PCM_OFFLOAD_FRAGMENT_SIZE (4 * 1024)
#define ALIGN( num, to ) (((num) + (to-1)) & (~(to-1)))
/*
@@ -1906,16 +1906,23 @@ uint32_t platform_get_pcm_offload_buffer_size(audio_offload_info_t* info)
} else if (info->has_video && info->is_streaming) {
fragment_size = (PCM_OFFLOAD_BUFFER_DURATION_FOR_AV_STREAMING
* info->sample_rate
- * bits_per_sample
+ * (bits_per_sample >> 3)
* popcount(info->channel_mask))/1000;
} else if (info->has_video) {
fragment_size = (PCM_OFFLOAD_BUFFER_DURATION_FOR_AV
* info->sample_rate
- * bits_per_sample
+ * (bits_per_sample >> 3)
* popcount(info->channel_mask))/1000;
}
+ char value[PROPERTY_VALUE_MAX] = {0};
+ if((property_get("audio.offload.pcm.buffer.size", value, "")) &&
+ atoi(value)) {
+ fragment_size = atoi(value) * 1024;
+ ALOGV("Using buffer size from sys prop %d", fragment_size);
+ }
+
fragment_size = ALIGN( fragment_size, 1024);
if(fragment_size < MIN_PCM_OFFLOAD_FRAGMENT_SIZE)