Skip to content

Commit

Permalink
pcm: add support to set silence_size
Browse files Browse the repository at this point in the history
Tinyalsa always set silence_size to zero. Add support to set this
pcm software parameter as required.

Bug: 20226809
Bug: 20300203
Change-Id: I25de43623dc04bf5a3ad4c6573bc2b8dad1eec5e
  • Loading branch information
mmaneetsingh authored and gkasten committed Jun 22, 2015
1 parent ed44a65 commit e25fe0b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions include/tinyalsa/asoundlib.h
Expand Up @@ -93,17 +93,20 @@ struct pcm_config {
unsigned int period_count;
enum pcm_format format;

/* Values to use for the ALSA start, stop and silence thresholds. Setting
* any one of these values to 0 will cause the default tinyalsa values to be
* used instead. Tinyalsa defaults are as follows.
/* Values to use for the ALSA start, stop and silence thresholds, and
* silence size. Setting any one of these values to 0 will cause the
* default tinyalsa values to be used instead.
* Tinyalsa defaults are as follows.
*
* start_threshold : period_count * period_size
* stop_threshold : period_count * period_size
* silence_threshold : 0
* silence_size : 0
*/
unsigned int start_threshold;
unsigned int stop_threshold;
unsigned int silence_threshold;
unsigned int silence_size;

/* Minimum number of frames available before pcm_mmap_write() will actually
* write into the kernel buffer. Only used if the stream is opened in mmap mode
Expand Down
2 changes: 1 addition & 1 deletion pcm.c
Expand Up @@ -953,8 +953,8 @@ struct pcm *pcm_open(unsigned int card, unsigned int device,
sparams.avail_min = config->avail_min;

sparams.xfer_align = config->period_size / 2; /* needed for old kernels */
sparams.silence_size = 0;
sparams.silence_threshold = config->silence_threshold;
sparams.silence_size = config->silence_size;
pcm->boundary = sparams.boundary = pcm->buffer_size;

while (pcm->boundary * 2 <= INT_MAX - pcm->buffer_size)
Expand Down

0 comments on commit e25fe0b

Please sign in to comment.