diff options
author | Christopher R. Palmer <crpalmer@gmail.com> | 2015-11-28 07:32:13 -0500 |
---|---|---|
committer | Christopher R. Palmer <crpalmer@gmail.com> | 2015-11-28 10:04:16 -0500 |
commit | d762c50816527af23c2927df2f1d97948229c770 (patch) | |
tree | 15c0be037c0ef16f0ee65f9d085e51980ed4d50e | |
parent | ceaf1a7a5f44343c91c785baae82d5fcc74fda66 (diff) | |
download | android_external_tinyalsa-d762c50816527af23c2927df2f1d97948229c770.tar.gz android_external_tinyalsa-d762c50816527af23c2927df2f1d97948229c770.tar.bz2 android_external_tinyalsa-d762c50816527af23c2927df2f1d97948229c770.zip |
tinyalsa: Add a board config to drop silence_size for blob compat.
In cm-13.0, this commit was added:
commit e25fe0b50ea717a9f347dcb927d396e8772e6362
Author: Maneet Singh <mmaneetsingh@nvidia.com>
Date: Thu Jun 11 17:34:40 2015 -0700
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
that changes the size of the pcm_config structure. This is a
problem for any device using older blobs that call pcm_open
as their structure is now invalid.
Fixing this via a prebuilt blob is not ideal because we have
source built components that also use tinyalsa (e.g. the qcom audio
HALs). Using a blob (either as a complete replacement or shim)
would involve having code in the same address space that uses two
incompatible copies of pcm_open (e.g. via a proprietary audio.primary.
and a source built audio.usb.).
Therefore, offer a compile option to enable this backward compatibility
support.
Change-Id: I4d96f2b1fe841fc19e83ddf9a4ca6c0f04bcd3f5
-rw-r--r-- | Android.mk | 5 | ||||
-rw-r--r-- | include/tinyalsa/asoundlib.h | 2 | ||||
-rw-r--r-- | pcm.c | 4 |
3 files changed, 11 insertions, 0 deletions
@@ -1,6 +1,11 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) + +ifeq ($(TARGET_TINY_ALSA_IGNORE_SILENCE_SIZE),true) + LOCAL_CFLAGS += -DIGNORE_SILENCE_SIZE +endif + LOCAL_C_INCLUDES:= external/tinyalsa/include LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include LOCAL_SRC_FILES:= mixer.c pcm.c diff --git a/include/tinyalsa/asoundlib.h b/include/tinyalsa/asoundlib.h index 97ee4f3..b789573 100644 --- a/include/tinyalsa/asoundlib.h +++ b/include/tinyalsa/asoundlib.h @@ -106,7 +106,9 @@ struct pcm_config { unsigned int start_threshold; unsigned int stop_threshold; unsigned int silence_threshold; +#ifndef IGNORE_SILENCE_SIZE unsigned int silence_size; +#endif /* 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 @@ -954,7 +954,11 @@ struct pcm *pcm_open(unsigned int card, unsigned int device, sparams.xfer_align = config->period_size / 2; /* needed for old kernels */ sparams.silence_threshold = config->silence_threshold; +#ifdef IGNORE_SILENCE_SIZE + sparams.silence_size = 0; +#else sparams.silence_size = config->silence_size; +#endif pcm->boundary = sparams.boundary = pcm->buffer_size; while (pcm->boundary * 2 <= INT_MAX - pcm->buffer_size) |