summaryrefslogtreecommitdiff
authorqidi.huang <qidi.huang@amlogic.com>2018-01-03 06:43:20 (GMT)
committer qidi.huang <qidi.huang@amlogic.com>2018-01-04 06:27:40 (GMT)
commit91186aa81ee4dbb313029d27e40d3d261704d916 (patch)
tree684b183991f539dbaf8cca130215a65be89465b3
parent8512e838137158c13c646e510ac84f4508301844 (diff)
downloadaudio-91186aa81ee4dbb313029d27e40d3d261704d916.zip
audio-91186aa81ee4dbb313029d27e40d3d261704d916.tar.gz
audio-91186aa81ee4dbb313029d27e40d3d261704d916.tar.bz2
Audio: fix Android 8.1 CTS AAudio failure. [1/1]
PD# 158018 Let A = sourceFramesNeededWithTimestrech() Let B = mFrameCount = mBufferSize / mFrameSize frameCount = minBufCount * A = (PERIOD_SIZE * PERIOD_COUNT) * A / ((1000 * multiplier * B) / afSampleRate) The value of frameCount is too large so CTS fails, to decrease frameCount, we can decrease (PERIOD_SIZE * PERIOD_COUNT), or increase mBufferSize. Through this way we can pass AAudio CTS test. Change-Id: Iefc2bd682c22e417f3c453d664f9b2a5e3d5aff4
Diffstat
-rw-r--r--audio_hw.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/audio_hw.c b/audio_hw.c
index c1a0a5f..a1485ef 100644
--- a/audio_hw.c
+++ b/audio_hw.c
@@ -69,15 +69,9 @@
#define PORT_I2S 0
#define PORT_SPDIF 1
#define PORT_PCM 2
-/* number of frames per period */
-#define DEFAULT_PERIOD_SIZE 1024
+
#define DEFAULT_CAPTURE_PERIOD_SIZE 1024
-//static unsigned PERIOD_SIZE = DEFAULT_PERIOD_SIZE;
static unsigned CAPTURE_PERIOD_SIZE = DEFAULT_CAPTURE_PERIOD_SIZE;
-/* number of periods for low power playback */
-#define PLAYBACK_PERIOD_COUNT 4
-/* number of periods for capture */
-#define CAPTURE_PERIOD_COUNT 4
/* minimum sleep time in out_write() when write threshold is not reached */
#define MIN_WRITE_SLEEP_US 5000
@@ -735,7 +729,8 @@ static size_t out_get_buffer_size(const struct audio_stream *stream)
if (out->config.rate == 96000)
size = PERIOD_SIZE * 2;
else
- size = PERIOD_SIZE;
+ // bug_id - 158018, modify size value from PERIOD_SIZE to (PERIOD_SIZE * PLAYBACK_PERIOD_COUNT)
+ size = PERIOD_SIZE * PLAYBACK_PERIOD_COUNT;
}
size = ((size + 15) / 16) * 16;
return size * audio_stream_out_frame_size((struct audio_stream_out *)stream);