summaryrefslogtreecommitdiff
authorJian Xu <jian.xu@amlogic.com>2016-05-16 11:05:05 (GMT)
committer Gerrit Code Review <gituser@git.myamlogic.com>2016-05-16 11:05:05 (GMT)
commit4ad0ac06e9ea8099e7668beaf13caada035a5457 (patch)
tree61e5857e6b1d743fce0e3edc2a8a19ca3c20cfe4
parentd74aeff0d50cfbbbbab86d636b6851a4c088b198 (diff)
parentc6e684ffcfcc2043b3967b3bd5912f51c97898e2 (diff)
downloadaudio-4ad0ac06e9ea8099e7668beaf13caada035a5457.zip
audio-4ad0ac06e9ea8099e7668beaf13caada035a5457.tar.gz
audio-4ad0ac06e9ea8099e7668beaf13caada035a5457.tar.bz2
Merge "PD#125238: audio: set default period size for AF" into m-amlogic
Diffstat
-rw-r--r--audio_hw.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/audio_hw.c b/audio_hw.c
index 85edce1..028b73a 100644
--- a/audio_hw.c
+++ b/audio_hw.c
@@ -650,7 +650,6 @@ static int check_input_parameters(uint32_t sample_rate, audio_format_t format, i
static size_t get_input_buffer_size(unsigned int period_size,uint32_t sample_rate, audio_format_t format, int channel_count)
{
size_t size;
- size_t device_rate;
LOGFUNC("%s(sample_rate=%d, format=%d, channel_count=%d)", __FUNCTION__, sample_rate, format, channel_count);
@@ -661,6 +660,10 @@ static size_t get_input_buffer_size(unsigned int period_size,uint32_t sample_rat
/* take resampling into account and return the closest majoring
multiple of 16 frames, as audioflinger expects audio buffers to
be a multiple of 16 frames */
+ if (period_size == 0) {
+ period_size = (pcm_config_in.period_size * sample_rate) / pcm_config_in.rate;
+ }
+
size = period_size;
size = ((size + 15) / 16) * 16;