alsa_sound: Add support for flexible buffer size for recording

- In the current implementation, all the read calls to the driver
  are limited to 320 bytes only. This results performance overhead
  for recording at higher sampling rates.
- Added support for flexible buffer size to allow upto 4096 bytes.

Bug: 7223456
Change-Id: Ic0522d92de905b04481a0d8daa103c77552257e8
Signed-off-by: Iliyan Malchev <malchev@google.com>
diff --git a/alsa_sound/alsa_default.cpp b/alsa_sound/alsa_default.cpp
index ea8ad2f..c285e1e 100644
--- a/alsa_sound/alsa_default.cpp
+++ b/alsa_sound/alsa_default.cpp
@@ -252,7 +252,6 @@
             || !strncmp(handle->useCase, SND_USE_CASE_MOD_CAPTURE_MUSIC, strlen(SND_USE_CASE_MOD_CAPTURE_MUSIC))) {
             ALOGV("HWParams: Use 4 channels in kernel for 5.1(%s) recording ", handle->useCase);
             channels = 4;
-            reqBuffSize = DEFAULT_IN_BUFFER_SIZE;
         }
     }
 #endif
@@ -275,7 +274,7 @@
                    format);
     param_set_mask(params, SNDRV_PCM_HW_PARAM_SUBFORMAT,
                    SNDRV_PCM_SUBFORMAT_STD);
-    param_set_min(params, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, reqBuffSize);
+    param_set_int(params, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, reqBuffSize);
     param_set_int(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, 16);
     param_set_int(params, SNDRV_PCM_HW_PARAM_FRAME_BITS,
                    channels * 16);