summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Lang <joshualang@google.com>2016-11-17 02:00:37 -0800
committerJoshua Lang <joshualang@google.com>2017-01-19 12:46:54 -0800
commit19297e0f2bbc7043f25b428599d4f50d7416f20a (patch)
tree6a1fc61e719853edfe4a140d00cd547cf51ee9b3
parent755c647fb270aa8dcf3392770667494e4a25d954 (diff)
downloaddevice_generic_goldfish-19297e0f2bbc7043f25b428599d4f50d7416f20a.tar.gz
device_generic_goldfish-19297e0f2bbc7043f25b428599d4f50d7416f20a.tar.bz2
device_generic_goldfish-19297e0f2bbc7043f25b428599d4f50d7416f20a.zip
Reduce audio buffer sizes
Reduce input stream buffer size to accommodate tests Set output stream buffer size in terms of ms to match input buffer Test: CtsMediaTestCases android.media.cts.AudioRecordTest#testTimestamp Bug: 31648354 Change-Id: Ifba7773cf48bfe985be955e0911b15dc85ec9b54 (cherry picked from commit 6b8a4352230ca15aa859d532f0d5eb967ad02985)
-rw-r--r--audio/audio_hw.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 51d0c9df..10fea6fd 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -36,10 +36,10 @@
#define PCM_DEVICE 0
-#define OUT_PERIOD_SIZE 1024
+#define OUT_PERIOD_MS 15
#define OUT_PERIOD_COUNT 4
-#define IN_PERIOD_MS 10
+#define IN_PERIOD_MS 2
#define IN_PERIOD_COUNT 4
struct generic_audio_device {
@@ -224,7 +224,7 @@ struct generic_stream_in {
static struct pcm_config pcm_config_out = {
.channels = 2,
.rate = 0,
- .period_size = OUT_PERIOD_SIZE,
+ .period_size = 0,
.period_count = OUT_PERIOD_COUNT,
.format = PCM_FORMAT_S16_LE,
.start_threshold = 0,
@@ -1170,6 +1170,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
memcpy(&out->req_config, config, sizeof(struct audio_config));
memcpy(&out->pcm_config, &pcm_config_out, sizeof(struct pcm_config));
out->pcm_config.rate = config->sample_rate;
+ out->pcm_config.period_size = out->pcm_config.rate*OUT_PERIOD_MS/1000;
out->standby = true;
out->underrun_position = 0;