audio/hal: Set playback buffer size to integral multiple of msec

- Set the deep-buffer and low-latency output buffer sizes to
  integral multiple of msec. This reduces the variations in
  the writes.
- Compute the input buffer size based on sample rate. Use 20msec
  buffers in capture path.

Bug: 9283911, 9106434
Change-Id: Icbcb653f7f0fd3293dd4b514a54ac91d8311b308
diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h
index 9b97648..f843fa8 100644
--- a/hal/msm8974/platform.h
+++ b/hal/msm8974/platform.h
@@ -102,9 +102,9 @@
  * We should take care of returning proper size when AudioFlinger queries for
  * the buffer size of an input/output stream
  */
-#define DEEP_BUFFER_OUTPUT_PERIOD_SIZE 1024
+#define DEEP_BUFFER_OUTPUT_PERIOD_SIZE 960
 #define DEEP_BUFFER_OUTPUT_PERIOD_COUNT 8
-#define LOW_LATENCY_OUTPUT_PERIOD_SIZE 256
+#define LOW_LATENCY_OUTPUT_PERIOD_SIZE 240
 #define LOW_LATENCY_OUTPUT_PERIOD_COUNT 2
 
 #define HDMI_MULTI_PERIOD_SIZE  336
@@ -112,7 +112,7 @@
 #define HDMI_MULTI_DEFAULT_CHANNEL_COUNT 6
 #define HDMI_MULTI_PERIOD_BYTES (HDMI_MULTI_PERIOD_SIZE * HDMI_MULTI_DEFAULT_CHANNEL_COUNT * 2)
 
-#define AUDIO_CAPTURE_PERIOD_SIZE 512
-#define AUDIO_CAPTURE_PERIOD_COUNT 16
+#define AUDIO_CAPTURE_PERIOD_DURATION_MSEC 20
+#define AUDIO_CAPTURE_PERIOD_COUNT 2
 
 #endif // QCOM_AUDIO_PLATFORM_H