From b083e14ebb87aeddbc08a5b7601cb3c95871a427 Mon Sep 17 00:00:00 2001 From: Pradnya Chaphekar Date: Tue, 2 Sep 2014 15:29:38 -0700 Subject: policy_hal: Return error in getOutput if passthrough is disabled If client sets passthrough flag when passthrough is disabled in hal, getPassthroughoutput does not return an error resulting in playback with passthrough. Return an error in this case such that the client is forced to recreate track with passthrough disabled. Change-Id: I9744372c0e2cb3f9362000c41d2173516c306c79 --- policy_hal/AudioPolicyManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp index bef73be7..c7566ad8 100644 --- a/policy_hal/AudioPolicyManager.cpp +++ b/policy_hal/AudioPolicyManager.cpp @@ -2094,14 +2094,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) && -- cgit v1.2.3 From a491ec640db2c2fdbb6975978cd4576fe83b3bde Mon Sep 17 00:00:00 2001 From: Pradnya Chaphekar Date: Wed, 3 Sep 2014 15:28:30 -0700 Subject: hal: Calculate buffer size for pcm offload with small buffer hint Currently the buffer size is hard-coded for pcm offload with small buffer hint. This does not work for multi-channel content. Calculate buffer size based on smaple rate, channel count and bytes per sample. Change-Id: I99ba02e3bc8949a4c9f9e79068e4fcfd12244119 --- hal/msm8974/platform.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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; } -- cgit v1.2.3