aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManeet Singh2015-06-11 19:34:40 -0500
committerGlenn Kasten2015-06-22 12:41:43 -0500
commite25fe0b50ea717a9f347dcb927d396e8772e6362 (patch)
treebf70b3894a612f226c5634637212669439246a7c
parented44a654c9bcbd3f7c77156fbb8db6c75ec3f691 (diff)
downloadplatform-external-tinyalsa-e25fe0b50ea717a9f347dcb927d396e8772e6362.tar.gz
platform-external-tinyalsa-e25fe0b50ea717a9f347dcb927d396e8772e6362.tar.xz
platform-external-tinyalsa-e25fe0b50ea717a9f347dcb927d396e8772e6362.zip
pcm: add support to set silence_size
Tinyalsa always set silence_size to zero. Add support to set this pcm software parameter as required. Bug: 20226809 Bug: 20300203 Change-Id: I25de43623dc04bf5a3ad4c6573bc2b8dad1eec5e
-rw-r--r--include/tinyalsa/asoundlib.h9
-rw-r--r--pcm.c2
2 files changed, 7 insertions, 4 deletions
diff --git a/include/tinyalsa/asoundlib.h b/include/tinyalsa/asoundlib.h
index 809e02d..1554b52 100644
--- a/include/tinyalsa/asoundlib.h
+++ b/include/tinyalsa/asoundlib.h
@@ -93,17 +93,20 @@ struct pcm_config {
93 unsigned int period_count; 93 unsigned int period_count;
94 enum pcm_format format; 94 enum pcm_format format;
95 95
96 /* Values to use for the ALSA start, stop and silence thresholds. Setting 96 /* Values to use for the ALSA start, stop and silence thresholds, and
97 * any one of these values to 0 will cause the default tinyalsa values to be 97 * silence size. Setting any one of these values to 0 will cause the
98 * used instead. Tinyalsa defaults are as follows. 98 * default tinyalsa values to be used instead.
99 * Tinyalsa defaults are as follows.
99 * 100 *
100 * start_threshold : period_count * period_size 101 * start_threshold : period_count * period_size
101 * stop_threshold : period_count * period_size 102 * stop_threshold : period_count * period_size
102 * silence_threshold : 0 103 * silence_threshold : 0
104 * silence_size : 0
103 */ 105 */
104 unsigned int start_threshold; 106 unsigned int start_threshold;
105 unsigned int stop_threshold; 107 unsigned int stop_threshold;
106 unsigned int silence_threshold; 108 unsigned int silence_threshold;
109 unsigned int silence_size;
107 110
108 /* Minimum number of frames available before pcm_mmap_write() will actually 111 /* Minimum number of frames available before pcm_mmap_write() will actually
109 * write into the kernel buffer. Only used if the stream is opened in mmap mode 112 * write into the kernel buffer. Only used if the stream is opened in mmap mode
diff --git a/pcm.c b/pcm.c
index d8af58a..e3a41b0 100644
--- a/pcm.c
+++ b/pcm.c
@@ -953,8 +953,8 @@ struct pcm *pcm_open(unsigned int card, unsigned int device,
953 sparams.avail_min = config->avail_min; 953 sparams.avail_min = config->avail_min;
954 954
955 sparams.xfer_align = config->period_size / 2; /* needed for old kernels */ 955 sparams.xfer_align = config->period_size / 2; /* needed for old kernels */
956 sparams.silence_size = 0;
957 sparams.silence_threshold = config->silence_threshold; 956 sparams.silence_threshold = config->silence_threshold;
957 sparams.silence_size = config->silence_size;
958 pcm->boundary = sparams.boundary = pcm->buffer_size; 958 pcm->boundary = sparams.boundary = pcm->buffer_size;
959 959
960 while (pcm->boundary * 2 <= INT_MAX - pcm->buffer_size) 960 while (pcm->boundary * 2 <= INT_MAX - pcm->buffer_size)