diff options
-rw-r--r-- | hal/msm8974/platform.c | 12 | ||||
-rw-r--r-- | policy_hal/AudioPolicyManager.cpp | 6 |
2 files changed, 15 insertions, 3 deletions
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c index 653a7682..010002b5 100644 --- a/hal/msm8974/platform.c +++ b/hal/msm8974/platform.c @@ -67,6 +67,7 @@ */ #define MAX_PCM_OFFLOAD_FRAGMENT_SIZE (240 * 1024) #define MIN_PCM_OFFLOAD_FRAGMENT_SIZE (4 * 1024) +#define PCM_OFFLOAD_SMALL_BUFFER_DURATION 20 /* 20 msec */ /* * Offload buffer size for compress passthrough @@ -2027,6 +2028,17 @@ uint32_t platform_get_pcm_offload_buffer_size(audio_offload_info_t* info) atoi(value)) { ALOGV("Track offload Fragment size set by property to %dkb", atoi(value)); fragment_size = atoi(value) * 1024; + } else if (info->use_small_bufs) { + fragment_size = (PCM_OFFLOAD_SMALL_BUFFER_DURATION + * info->sample_rate + * audio_bytes_per_sample(info->format) + * popcount(info->channel_mask))/1000; + ALOGV("%s: fragment size for small buffer mode = %d" + "sample_rate=%d bytes_per_sample=%d channel_count=%d\n", + __func__, fragment_size, + info->sample_rate, + audio_bytes_per_sample(info->format), + popcount(info->channel_mask)); } else { fragment_size = MIN_PCM_OFFLOAD_FRAGMENT_SIZE; } diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp index 03599960..983a7307 100644 --- a/policy_hal/AudioPolicyManager.cpp +++ b/policy_hal/AudioPolicyManager.cpp @@ -2350,14 +2350,14 @@ audio_io_handle_t AudioPolicyManager::getPassthroughOutput( // output. This is required if client sets passthrough flag directly. bool shouldReturnError = false; + if (flags & AUDIO_OUTPUT_FLAG_COMPRESS_PASSTHROUGH) + shouldReturnError = true; + if (!isHDMIPassthroughEnabled()) { ALOGV("getPassthroughOutput: passthrough not enabled"); goto noPassthrough; } - if (flags & AUDIO_OUTPUT_FLAG_COMPRESS_PASSTHROUGH) - shouldReturnError = true; - // Passthrough used for dolby formats and if device is HDMI if ((format == AUDIO_FORMAT_EAC3 || format == AUDIO_FORMAT_AC3 || format == AUDIO_FORMAT_E_AC3_JOC) && |