diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2015-10-27 09:26:53 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-10-27 09:26:53 -0700 |
commit | 6e4b3b70ef2adfeea1a7614968280e68711ddaf7 (patch) | |
tree | 991eb4bbf2c59d66f9e9cae33cd61971309f1786 | |
parent | 6e37c972aa4bc27de83889d74d6eaa6e5e25a44f (diff) | |
parent | 8d896651caee5cf7261943cd7c3a25f3d6a264cf (diff) | |
download | android_hardware_qcom_audio-6e4b3b70ef2adfeea1a7614968280e68711ddaf7.tar.gz android_hardware_qcom_audio-6e4b3b70ef2adfeea1a7614968280e68711ddaf7.tar.bz2 android_hardware_qcom_audio-6e4b3b70ef2adfeea1a7614968280e68711ddaf7.zip |
Merge "hal: Increase PCM offload buffering"
-rw-r--r-- | hal/msm8916/platform.c | 31 | ||||
-rw-r--r-- | hal/msm8974/platform.c | 21 |
2 files changed, 14 insertions, 38 deletions
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c index 8e3ac78e..064431ce 100644 --- a/hal/msm8916/platform.c +++ b/hal/msm8916/platform.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2013 The Android Open Source Project @@ -56,15 +56,14 @@ #define COMPRESS_OFFLOAD_FRAGMENT_SIZE_FOR_AV_STREAMING (2 * 1024) #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 40 /* 40 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))) /* @@ -2575,27 +2574,19 @@ uint32_t platform_get_pcm_offload_buffer_size(audio_offload_info_t* info) { uint32_t fragment_size = MIN_PCM_OFFLOAD_FRAGMENT_SIZE; uint32_t bits_per_sample = 16; + uint32_t pcm_offload_time = PCM_OFFLOAD_BUFFER_DURATION; if (info->format == AUDIO_FORMAT_PCM_24_BIT_OFFLOAD) { bits_per_sample = 32; } - if (!info->has_video) { - fragment_size = MAX_PCM_OFFLOAD_FRAGMENT_SIZE; - - } else if (info->has_video && info->is_streaming) { - fragment_size = (PCM_OFFLOAD_BUFFER_DURATION_FOR_AV_STREAMING - * info->sample_rate - * bits_per_sample - * popcount(info->channel_mask))/1000; - - } else if (info->has_video) { - fragment_size = (PCM_OFFLOAD_BUFFER_DURATION_FOR_AV - * info->sample_rate - * bits_per_sample - * popcount(info->channel_mask))/1000; - } - + //duration is set to 40 ms worth of stereo data at 48Khz + //with 16 bit per sample, modify this when the channel + //configuration is different + fragment_size = (pcm_offload_time + * info->sample_rate + * (bits_per_sample >> 3) + * popcount(info->channel_mask))/1000; fragment_size = ALIGN( fragment_size, 1024); if(fragment_size < MIN_PCM_OFFLOAD_FRAGMENT_SIZE) diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c index b2fa577b..0086c918 100644 --- a/hal/msm8974/platform.c +++ b/hal/msm8974/platform.c @@ -61,10 +61,7 @@ #define COMPRESS_OFFLOAD_FRAGMENT_SIZE (32 * 1024) /* Used in calculating fragment size for pcm offload */ -#define PCM_OFFLOAD_BUFFER_DURATION_FOR_AV 1000 /* 1 sec */ -#define PCM_OFFLOAD_BUFFER_DURATION_FOR_AV_STREAMING 80 /* 80 millisecs */ -#define PCM_OFFLOAD_BUFFER_DURATION_FOR_SMALL_BUFFERS 20 /* 20 millisecs */ -#define PCM_OFFLOAD_BUFFER_DURATION_MAX 1200 /* 1200 millisecs */ +#define PCM_OFFLOAD_BUFFER_DURATION 40 /* 40 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 @@ -2942,25 +2939,13 @@ uint32_t platform_get_pcm_offload_buffer_size(audio_offload_info_t* info) { uint32_t fragment_size = 0; uint32_t bits_per_sample = 16; - uint32_t pcm_offload_time = PCM_OFFLOAD_BUFFER_DURATION_FOR_SMALL_BUFFERS; + uint32_t pcm_offload_time = PCM_OFFLOAD_BUFFER_DURATION; if (info->format == AUDIO_FORMAT_PCM_24_BIT_OFFLOAD) { bits_per_sample = 32; } - if (platform_use_small_buffer(info)) { - pcm_offload_time = PCM_OFFLOAD_BUFFER_DURATION_FOR_SMALL_BUFFERS; - } else { - if (!info->has_video) { - pcm_offload_time = PCM_OFFLOAD_BUFFER_DURATION_MAX; - } else if (info->has_video && info->is_streaming) { - pcm_offload_time = PCM_OFFLOAD_BUFFER_DURATION_FOR_AV_STREAMING; - } else if (info->has_video) { - pcm_offload_time = PCM_OFFLOAD_BUFFER_DURATION_FOR_AV; - } - } - - //duration is set to 20 ms worth of stereo data at 48Khz + //duration is set to 40 ms worth of stereo data at 48Khz //with 16 bit per sample, modify this when the channel //configuration is different fragment_size = (pcm_offload_time |