Merge "hal: Correct PCM offload fragment size"

This commit is contained in:
Linux Build Service Account 2014-05-02 11:05:35 -07:00 committed by Gerrit - the friendly Code Review server
commit 8471e80526
1 changed files with 12 additions and 5 deletions

View File

@ -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)))
/*
@ -2022,16 +2022,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)