Merge "hal: Add dynamic enablement of AEC/NS for VoIP"
diff --git a/configs/apq8098_latv/apq8098_latv.mk b/configs/apq8098_latv/apq8098_latv.mk
index 242c6d5..c9178cf 100644
--- a/configs/apq8098_latv/apq8098_latv.mk
+++ b/configs/apq8098_latv/apq8098_latv.mk
@@ -56,6 +56,7 @@
AUDIO_FEATURE_ENABLED_SPKR_PROTECTION := true
AUDIO_FEATURE_ENABLED_ACDB_LICENSE := true
AUDIO_FEATURE_ENABLED_DEV_ARBI := false
+AUDIO_FEATURE_ENABLED_DYNAMIC_LOG := true
MM_AUDIO_ENABLED_FTM := true
TARGET_USES_QCOM_MM_AUDIO := true
AUDIO_FEATURE_ENABLED_SOURCE_TRACKING := true
@@ -96,7 +97,8 @@
hardware/qcom/audio/configs/msm8998/sound_trigger_mixer_paths_wcd9340.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_mixer_paths_wcd9340.xml \
hardware/qcom/audio/configs/msm8998/sound_trigger_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_platform_info.xml \
hardware/qcom/audio/configs/msm8998/graphite_ipc_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/graphite_ipc_platform_info.xml \
- hardware/qcom/audio/configs/msm8998/audio_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info.xml
+ hardware/qcom/audio/configs/msm8998/audio_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info.xml \
+ vendor/qcom/proprietary/mm-audio/audio-log-utils/audio_dynamic_log.xml:$(TARGET_COPY_OUT_VENDOR)/data/vendor/misc/audio/audio_dynamic_log.xml
#XML Audio configuration files
ifeq ($(USE_XML_AUDIO_POLICY_CONF), 1)
diff --git a/configs/msm8909/msm8909.mk b/configs/msm8909/msm8909.mk
index 9a32dee..c3305e9 100755
--- a/configs/msm8909/msm8909.mk
+++ b/configs/msm8909/msm8909.mk
@@ -65,7 +65,8 @@
hardware/qcom/audio/configs/msm8909/sound_trigger_mixer_paths.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_mixer_paths.xml \
hardware/qcom/audio/configs/msm8909/sound_trigger_mixer_paths_wcd9326.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_mixer_paths_wcd9326.xml \
hardware/qcom/audio/configs/msm8909/sound_trigger_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_platform_info.xml \
- hardware/qcom/audio/configs/msm8909/audio_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info.xml
+ hardware/qcom/audio/configs/msm8909/audio_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info.xml \
+ vendor/qcom/proprietary/mm-audio/audio-log-utils/audio_dynamic_log.xml:$(TARGET_COPY_OUT_VENDOR)/data/vendor/misc/audio/audio_dynamic_log.xml
#XML Audio configuration files
ifeq ($(USE_XML_AUDIO_POLICY_CONF), 1)
diff --git a/configs/msm8937/msm8937.mk b/configs/msm8937/msm8937.mk
index 6200705..9de472f 100644
--- a/configs/msm8937/msm8937.mk
+++ b/configs/msm8937/msm8937.mk
@@ -95,7 +95,8 @@
hardware/qcom/audio/configs/msm8937/mixer_paths_qrd_sku2.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths_qrd_sku2.xml \
hardware/qcom/audio/configs/msm8937/audio_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info.xml \
hardware/qcom/audio/configs/msm8937/audio_platform_info_extcodec.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info_extcodec.xml \
-hardware/qcom/audio/configs/msm8937/audio_tuning_mixer.txt:$(TARGET_COPY_OUT_VENDOR)/etc/audio_tuning_mixer.txt
+hardware/qcom/audio/configs/msm8937/audio_tuning_mixer.txt:$(TARGET_COPY_OUT_VENDOR)/etc/audio_tuning_mixer.txt \
+vendor/qcom/proprietary/mm-audio/audio-log-utils/audio_dynamic_log.xml:$(TARGET_COPY_OUT_VENDOR)/data/vendor/misc/audio/audio_dynamic_log.xml
#XML Audio configuration files
ifeq ($(USE_XML_AUDIO_POLICY_CONF), 1)
diff --git a/configs/msm8953/msm8953.mk b/configs/msm8953/msm8953.mk
index 068317d..035c3f3 100644
--- a/configs/msm8953/msm8953.mk
+++ b/configs/msm8953/msm8953.mk
@@ -94,7 +94,8 @@
hardware/qcom/audio/configs/msm8953/sound_trigger_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_platform_info.xml \
hardware/qcom/audio/configs/msm8953/audio_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info.xml \
hardware/qcom/audio/configs/msm8953/audio_platform_info_extcodec.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info_extcodec.xml \
-hardware/qcom/audio/configs/msm8953/audio_tuning_mixer.txt:$(TARGET_COPY_OUT_VENDOR)/etc/audio_tuning_mixer.txt
+hardware/qcom/audio/configs/msm8953/audio_tuning_mixer.txt:$(TARGET_COPY_OUT_VENDOR)/etc/audio_tuning_mixer.txt \
+vendor/qcom/proprietary/mm-audio/audio-log-utils/audio_dynamic_log.xml:$(TARGET_COPY_OUT_VENDOR)/data/vendor/misc/audio/audio_dynamic_log.xml
#XML Audio configuration files
ifeq ($(USE_XML_AUDIO_POLICY_CONF), 1)
diff --git a/configs/msm8996/msm8996.mk b/configs/msm8996/msm8996.mk
index 2b815ae..178de2e 100644
--- a/configs/msm8996/msm8996.mk
+++ b/configs/msm8996/msm8996.mk
@@ -82,7 +82,8 @@
hardware/qcom/audio/configs/msm8996/sound_trigger_mixer_paths.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_mixer_paths.xml \
hardware/qcom/audio/configs/msm8996/sound_trigger_mixer_paths_wcd9330.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_mixer_paths_wcd9330.xml \
hardware/qcom/audio/configs/msm8996/sound_trigger_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_platform_info.xml \
- hardware/qcom/audio/configs/msm8996/audio_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info.xml
+ hardware/qcom/audio/configs/msm8996/audio_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info.xml \
+ vendor/qcom/proprietary/mm-audio/audio-log-utils/audio_dynamic_log.xml:$(TARGET_COPY_OUT_VENDOR)/data/vendor/misc/audio/audio_dynamic_log.xml
#XML Audio configuration files
ifeq ($(USE_XML_AUDIO_POLICY_CONF), 1)
diff --git a/configs/msm8998/msm8998.mk b/configs/msm8998/msm8998.mk
index dd68841..e190e29 100644
--- a/configs/msm8998/msm8998.mk
+++ b/configs/msm8998/msm8998.mk
@@ -96,7 +96,8 @@
hardware/qcom/audio/configs/msm8998/sound_trigger_mixer_paths_wcd9340.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_mixer_paths_wcd9340.xml \
hardware/qcom/audio/configs/msm8998/sound_trigger_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_platform_info.xml \
hardware/qcom/audio/configs/msm8998/graphite_ipc_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/graphite_ipc_platform_info.xml \
- hardware/qcom/audio/configs/msm8998/audio_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info.xml
+ hardware/qcom/audio/configs/msm8998/audio_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info.xml \
+ vendor/qcom/proprietary/mm-audio/audio-log-utils/audio_dynamic_log.xml:$(TARGET_COPY_OUT_VENDOR)/data/vendor/misc/audio/audio_dynamic_log.xml
#XML Audio configuration files
ifeq ($(USE_XML_AUDIO_POLICY_CONF), 1)
diff --git a/configs/sdm660/sdm660.mk b/configs/sdm660/sdm660.mk
index 8d57a46..f805467 100644
--- a/configs/sdm660/sdm660.mk
+++ b/configs/sdm660/sdm660.mk
@@ -57,6 +57,7 @@
AUDIO_FEATURE_ENABLED_SPKR_PROTECTION := true
AUDIO_FEATURE_ENABLED_ACDB_LICENSE := true
AUDIO_FEATURE_ENABLED_DEV_ARBI := false
+AUDIO_FEATURE_ENABLED_DYNAMIC_LOG := true
MM_AUDIO_ENABLED_FTM := true
TARGET_USES_QCOM_MM_AUDIO := true
AUDIO_FEATURE_ENABLED_SOURCE_TRACKING := true
@@ -99,7 +100,8 @@
hardware/qcom/audio/configs/sdm660/sound_trigger_mixer_paths_wcd9335.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_mixer_paths_wcd9335.xml \
hardware/qcom/audio/configs/sdm660/sound_trigger_mixer_paths_wcd9340.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_mixer_paths_wcd9340.xml \
hardware/qcom/audio/configs/sdm660/sound_trigger_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_platform_info.xml \
- hardware/qcom/audio/configs/sdm660/graphite_ipc_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/graphite_ipc_platform_info.xml
+ hardware/qcom/audio/configs/sdm660/graphite_ipc_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/graphite_ipc_platform_info.xml \
+ vendor/qcom/proprietary/mm-audio/audio-log-utils/audio_dynamic_log.xml:$(TARGET_COPY_OUT_VENDOR)/data/vendor/misc/audio/audio_dynamic_log.xml
#XML Audio configuration files
ifeq ($(USE_XML_AUDIO_POLICY_CONF), 1)
diff --git a/configs/sdm670/sdm670.mk b/configs/sdm670/sdm670.mk
index d69964b..ae7ddbf 100644
--- a/configs/sdm670/sdm670.mk
+++ b/configs/sdm670/sdm670.mk
@@ -24,6 +24,7 @@
AUDIO_FEATURE_ENABLED_PROXY_DEVICE := true
AUDIO_FEATURE_ENABLED_SSR := true
AUDIO_FEATURE_ENABLED_DTS_EAGLE := false
+AUDIO_FEATURE_ENABLED_DYNAMIC_LOG := true
BOARD_USES_SRS_TRUEMEDIA := false
DTS_CODEC_M_ := false
MM_AUDIO_ENABLED_SAFX := true
@@ -100,6 +101,7 @@
hardware/qcom/audio/configs/sdm670/sound_trigger_mixer_paths_wcd9340.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_mixer_paths_wcd9340.xml \
hardware/qcom/audio/configs/sdm670/sound_trigger_mixer_paths_wcd9340.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_mixer_paths_wcd9340.xml \
hardware/qcom/audio/configs/sdm670/graphite_ipc_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/graphite_ipc_platform_info.xml \
+ vendor/qcom/proprietary/mm-audio/audio-log-utils/audio_dynamic_log.xml:$(TARGET_COPY_OUT_VENDOR)/data/vendor/misc/audio/audio_dynamic_log.xml
#XML Audio configuration files
ifeq ($(USE_XML_AUDIO_POLICY_CONF), 1)
diff --git a/configs/sdm845/sdm845.mk b/configs/sdm845/sdm845.mk
index 33eccb5..72e00c9 100644
--- a/configs/sdm845/sdm845.mk
+++ b/configs/sdm845/sdm845.mk
@@ -54,6 +54,7 @@
AUDIO_FEATURE_ENABLED_SPKR_PROTECTION := true
AUDIO_FEATURE_ENABLED_ACDB_LICENSE := false
AUDIO_FEATURE_ENABLED_DEV_ARBI := false
+AUDIO_FEATURE_ENABLED_DYNAMIC_LOG := true
MM_AUDIO_ENABLED_FTM := true
TARGET_USES_QCOM_MM_AUDIO := true
AUDIO_FEATURE_ENABLED_SOURCE_TRACKING := true
@@ -87,7 +88,8 @@
hardware/qcom/audio/configs/sdm845/sound_trigger_mixer_paths_wcd9340.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_mixer_paths_wcd9340.xml \
hardware/qcom/audio/configs/sdm845/sound_trigger_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sound_trigger_platform_info.xml \
hardware/qcom/audio/configs/sdm845/graphite_ipc_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/graphite_ipc_platform_info.xml \
- hardware/qcom/audio/configs/sdm845/audio_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info.xml
+ hardware/qcom/audio/configs/sdm845/audio_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info.xml \
+ vendor/qcom/proprietary/mm-audio/audio-log-utils/audio_dynamic_log.xml:$(TARGET_COPY_OUT_VENDOR)/data/vendor/misc/audio/audio_dynamic_log.xml
#XML Audio configuration files
ifeq ($(USE_XML_AUDIO_POLICY_CONF), 1)
@@ -190,7 +192,7 @@
#split a2dp DSP supported encoder list
PRODUCT_PROPERTY_OVERRIDES += \
-persist.vendor.bt.a2dp_offload_cap=sbc-aptx-aptxhd-aac
+persist.vendor.bt.a2dp_offload_cap=sbc-aptx-aptxtws-aptxhd-aac
#enable software decoders for ALAC and APE
PRODUCT_PROPERTY_OVERRIDES += \
diff --git a/hal/audio_extn/audio_defs.h b/hal/audio_extn/audio_defs.h
index 4e5f4d8..7abc89b 100644
--- a/hal/audio_extn/audio_defs.h
+++ b/hal/audio_extn/audio_defs.h
@@ -240,11 +240,12 @@
uint16_t num_output_channels;
uint16_t num_input_channels;
uint8_t has_output_channel_map;
- uint32_t output_channel_map[AUDIO_CHANNEL_COUNT_MAX];
+ uint16_t output_channel_map[AUDIO_CHANNEL_COUNT_MAX];
uint8_t has_input_channel_map;
- uint32_t input_channel_map[AUDIO_CHANNEL_COUNT_MAX];
+ uint16_t input_channel_map[AUDIO_CHANNEL_COUNT_MAX];
uint8_t has_mixer_coeffs;
- float mixer_coeffs[AUDIO_CHANNEL_COUNT_MAX][AUDIO_CHANNEL_COUNT_MAX];
+ /* member for coefficient gains in Q14 format */
+ uint32_t mixer_coeffs[AUDIO_CHANNEL_COUNT_MAX][AUDIO_CHANNEL_COUNT_MAX];
} mix_matrix_params_t;
typedef union {
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index 1f350aa..7f32f4d 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -116,7 +116,7 @@
#endif
#ifndef AUDIO_OUTPUT_FLAG_INTERACTIVE
-#define AUDIO_OUTPUT_FLAG_INTERACTIVE 0x80000000
+#define AUDIO_OUTPUT_FLAG_INTERACTIVE 0x4000000
#endif
#ifndef COMPRESS_METADATA_NEEDED
diff --git a/hal/audio_extn/qaf.c b/hal/audio_extn/qaf.c
index ca83b1d..44d471c 100644
--- a/hal/audio_extn/qaf.c
+++ b/hal/audio_extn/qaf.c
@@ -129,6 +129,8 @@
FILE *fp_output_writer_hdmi = NULL;
#endif
+void set_hdmi_configuration_to_module();
+
struct qaf_adsp_hdlr_config_state {
struct audio_adsp_event event_params;
/* For holding client audio_adsp_event payload */
@@ -386,7 +388,7 @@
static int get_media_fmt_array_index_for_output_id(
struct qaf_module* qaf_mod,
- int output_id)
+ uint32_t output_id)
{
int i;
for (i = 0; i < MAX_QAF_MODULE_OUT; i++) {
@@ -496,7 +498,7 @@
{
DEBUG_MSG();
- int ret = 0, k;
+ int ret = 0;
struct stream_out *out = p_qaf->passthrough_in;
if (!out) return -EINVAL;
@@ -592,7 +594,7 @@
static int audio_extn_qaf_stream_stop(struct stream_out *out)
{
int ret = 0;
- DEBUG_MSG("Output Stream 0x%x", out);
+ DEBUG_MSG("Output Stream 0x%p", out);
if (!check_stream_state(out, RUN)) return ret;
@@ -837,7 +839,7 @@
return fragment_size;
}
-static uint32_t qaf_get_pcm_offload_input_buffer_size(info)
+static uint32_t qaf_get_pcm_offload_input_buffer_size(audio_offload_info_t* info)
{
return qaf_get_pcm_offload_buffer_size(info, MS12_PCM_IN_FRAGMENT_SIZE);
}
@@ -1132,21 +1134,22 @@
DEBUG_MSG("Output Stream %p", out);
lock_output_stream(out);
- //If QAF passthrough is active then block the flush on module input streams.
- if (p_qaf->passthrough_out) {
- pthread_mutex_lock(&p_qaf->lock);
- //If flush is received for the QAF passthrough stream then call the primary HAL api.
- if (p_qaf->passthrough_in == out) {
- status = p_qaf->passthrough_out->stream.flush(
- (struct audio_stream_out *)p_qaf->passthrough_out);
- out->offload_state = OFFLOAD_STATE_IDLE;
+ if (!out->standby) {
+ //If QAF passthrough is active then block the flush on module input streams.
+ if (p_qaf->passthrough_out) {
+ pthread_mutex_lock(&p_qaf->lock);
+ //If flush is received for the QAF passthrough stream then call the primary HAL api.
+ if (p_qaf->passthrough_in == out) {
+ status = p_qaf->passthrough_out->stream.flush(
+ (struct audio_stream_out *)p_qaf->passthrough_out);
+ out->offload_state = OFFLOAD_STATE_IDLE;
+ }
+ pthread_mutex_unlock(&p_qaf->lock);
+ } else {
+ //Flush the module input stream.
+ status = audio_extn_qaf_stream_flush(out);
}
- pthread_mutex_unlock(&p_qaf->lock);
- } else {
- //Flush the module input stream.
- status = audio_extn_qaf_stream_flush(out);
}
-
unlock_output_stream(out);
DEBUG_MSG("Exit");
return status;
@@ -1227,7 +1230,7 @@
if (media_fmt == NULL || out == NULL) {
return;
}
- struct audio_out_channel_map_param chmap = {0};
+ struct audio_out_channel_map_param chmap = {0,{0}};
int i = 0;
chmap.channels = media_fmt->channels;
for (i = 0; i < chmap.channels && i < AUDIO_CHANNEL_COUNT_MAX && i < AUDIO_QAF_MAX_CHANNELS;
@@ -1238,7 +1241,7 @@
}
/* Call back function for mm module. */
-static void notify_event_callback(audio_session_handle_t session_handle /*__unused*/,
+static void notify_event_callback(audio_session_handle_t session_handle __unused,
void *prv_data,
void *buf,
audio_event_id_t event_id,
@@ -1255,7 +1258,7 @@
1.Open compress device for HDMI(PCM or AC3) based on current hdmi o/p format and write
data to the HDMI device.
*/
- int ret, i;
+ int ret;
audio_output_flags_t flags;
struct qaf_module* qaf_mod = (struct qaf_module*)prv_data;
struct audio_stream_out *bt_stream = NULL;
@@ -1293,7 +1296,7 @@
audio_qaf_out_buffer_t *buf_payload = (audio_qaf_out_buffer_t*)buf;
int index = -1;
- if (size < sizeof(audio_qaf_out_buffer_t)) {
+ if ((uint32_t)size < sizeof(audio_qaf_out_buffer_t)) {
ERROR_MSG("AUDIO_DATA_EVENT_V2 payload size is not sufficient.");
return;
}
@@ -1338,7 +1341,7 @@
audio_qaf_media_format_t *p_cached_fmt = NULL;
int index = -1;
- if (size < sizeof(audio_qaf_media_format_t)) {
+ if ( (uint32_t)size < sizeof(audio_qaf_media_format_t)) {
ERROR_MSG("Size is not proper for the event AUDIO_OUTPUT_MEDIA_FORMAT_EVENT.");
return ;
}
@@ -1448,7 +1451,6 @@
/* CASE 2: Multi-Channel PCM output to HDMI.
* If any other HDMI output is already enabled then this has to be dropped.
*/
- bool create_mch_out_stream = false;
if (p_qaf->passthrough_enabled) {
//Closing all the multi-Channel PCM HDMI output stream from QAF.
@@ -1487,7 +1489,7 @@
}
devices = AUDIO_DEVICE_OUT_AUX_DIGITAL;
- flags = (AUDIO_OUTPUT_FLAG_DIRECT | AUDIO_OUTPUT_FLAG_DIRECT_PCM);
+ flags = AUDIO_OUTPUT_FLAG_DIRECT;
ret = adev_open_output_stream((struct audio_hw_device *)p_qaf->adev,
QAF_DEFAULT_COMPR_AUDIO_HANDLE,
@@ -1603,7 +1605,7 @@
devices = device;
}
- flags = (AUDIO_OUTPUT_FLAG_DIRECT | AUDIO_OUTPUT_FLAG_DIRECT_PCM);
+ flags = AUDIO_OUTPUT_FLAG_DIRECT;
/* TODO:: Need to Propagate errors to framework */
ret = adev_open_output_stream((struct audio_hw_device *)p_qaf->adev,
@@ -1855,7 +1857,7 @@
{
ALOGV("%s %d", __func__, __LINE__);
unsigned char* license_data = NULL;
- device_license_config_t lic_config = {0};
+ device_license_config_t lic_config = {NULL, 0, 0};
int ret = -ENOSYS, size = 0;
char value[PROPERTY_VALUE_MAX] = {0};
struct qaf_module *qaf_mod = NULL;
@@ -2264,9 +2266,8 @@
/* Sets the stream set parameters (device routing information). */
static int qaf_out_set_parameters(struct audio_stream *stream, const char *kvpairs)
{
- struct str_parms *parms, *new_parms;
+ struct str_parms *parms;
char value[32];
- char *new_kv_pairs;
int val = 0;
struct stream_out *out = (struct stream_out *)stream;
int ret = 0;
@@ -2410,7 +2411,7 @@
/*ADSP event is not supported for passthrough*/
if ((param_id == AUDIO_EXTN_PARAM_ADSP_STREAM_CMD)
- && !(new_out->flags & AUDIO_OUTPUT_FLAG_DIRECT_PCM)) continue;
+ && !(new_out->flags == AUDIO_OUTPUT_FLAG_DIRECT)) continue;
if (new_out->standby)
new_out->stream.write((struct audio_stream_out *)new_out, NULL, 0);
lock_output_stream(new_out);
@@ -2427,8 +2428,7 @@
audio_extn_param_payload *payload)
{
int ret = -EINVAL, i;
- struct stream_out *new_out;
- struct audio_usecase *uc_info;
+ struct stream_out *new_out = NULL;
struct qaf_module *qaf_mod = get_qaf_module_for_input_stream(out);
if (!out || !qaf_mod || !payload) {
@@ -2521,7 +2521,7 @@
out->config.period_count = DEEP_BUFFER_OUTPUT_PERIOD_COUNT;
out->config.start_threshold = QAF_DEEP_BUFFER_OUTPUT_PERIOD_SIZE / 4;
out->config.avail_min = QAF_DEEP_BUFFER_OUTPUT_PERIOD_SIZE / 4;
- } else if(out->flags & AUDIO_OUTPUT_FLAG_DIRECT_PCM) {
+ } else if(out->flags == AUDIO_OUTPUT_FLAG_DIRECT) {
out->compr_config.fragment_size = qaf_get_pcm_offload_input_buffer_size(&(config->offload_info));
}
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 9f57580..d1367a7 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1603,7 +1603,9 @@
ssize_t count = audio_extn_usb_get_sup_sample_rates(is_playback,
supported_sample_rates,
max_rates);
- for (ssize_t i=0; i<count; i++) {
+ ssize_t i = 0;
+
+ for (i=0; i<count; i++) {
ALOGV("%s %s %d", __func__, is_playback ? "P" : "C",
supported_sample_rates[i]);
}
@@ -1896,8 +1898,12 @@
bool ret = false;
bool is_it_true_mode = false;
+ if(usecase->stream.out == NULL) {
+ ALOGE("%s: stream.out is NULL", __func__);
+ return false;
+ }
+
if (is_offload_usecase(usecase->id) &&
- (usecase->stream.out) &&
(usecase->stream.out->sample_rate == OUTPUT_SAMPLING_RATE_44100) &&
(usecase->stream.out->devices == AUDIO_DEVICE_OUT_WIRED_HEADSET ||
usecase->stream.out->devices == AUDIO_DEVICE_OUT_WIRED_HEADPHONE)) {
@@ -1912,8 +1918,7 @@
// Force all a2dp output devices to reconfigure for proper AFE encode format
//Also handle a case where in earlier a2dp start failed as A2DP stream was
//in suspended state, hence try to trigger a retry when we again get a routing request.
- if((usecase->stream.out) &&
- (usecase->stream.out->devices & AUDIO_DEVICE_OUT_ALL_A2DP) &&
+ if((usecase->stream.out->devices & AUDIO_DEVICE_OUT_ALL_A2DP) &&
audio_extn_a2dp_is_force_device_switch()) {
ALOGD("Force a2dp device switch to update new encoder config");
ret = true;
@@ -3728,9 +3733,9 @@
for (j = 0; j < ARRAY_SIZE(channels_name_to_enum_table); j++) {
if (channels_name_to_enum_table[j].value == supported_channel_masks[i]) {
if (!first)
- strcat(value, "|");
+ strlcat(value, "|", sizeof(value));
- strcat(value, channels_name_to_enum_table[j].name);
+ strlcat(value, channels_name_to_enum_table[j].name, sizeof(value));
first = false;
break;
}
@@ -3758,9 +3763,9 @@
for (j = 0; j < ARRAY_SIZE(formats_name_to_enum_table); j++) {
if (formats_name_to_enum_table[j].value == supported_formats[i]) {
if (!first) {
- strcat(value, "|");
+ strlcat(value, "|", sizeof(value));
}
- strcat(value, formats_name_to_enum_table[j].name);
+ strlcat(value, formats_name_to_enum_table[j].name, sizeof(value));
first = false;
break;
}
@@ -5601,8 +5606,8 @@
out->stream.pause = out_pause;
out->stream.resume = out_resume;
out->stream.flush = out_flush;
+ out->stream.set_callback = out_set_callback;
if (out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) {
- out->stream.set_callback = out_set_callback;
out->stream.drain = out_drain;
out->usecase = get_offload_usecase(adev, true /* is_compress */);
ALOGV("Compress Offload usecase .. usecase selected %d", out->usecase);
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 5542919..d5f1b86 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -6432,12 +6432,7 @@
int iter_i = 0;
int iter_j = 0;
int length = 0;
- int pan_scale_data[MAX_LENGTH_MIXER_CONTROL_IN_INT] = {0};
-
- if (sizeof(mm_params) > MAX_LENGTH_MIXER_CONTROL_IN_INT) {
- ret = -EINVAL;
- goto end;
- }
+ char *pan_scale_data = NULL;
snprintf(mixer_ctl_name, sizeof(mixer_ctl_name),
"Audio Stream %d Pan Scale Control", snd_id);
@@ -6450,40 +6445,60 @@
ret = -EINVAL;
goto end;
}
- pan_scale_data[length++] = mm_params.num_output_channels;
- pan_scale_data[length++] = mm_params.num_input_channels;
+ pan_scale_data = (char *) calloc(1, sizeof(mm_params));
+ if (!pan_scale_data) {
+ ret = -ENOMEM;
+ goto end;
+ }
+ memcpy(&pan_scale_data[length], &mm_params.num_output_channels,
+ sizeof(mm_params.num_output_channels));
+ length += sizeof(mm_params.num_output_channels);
+ memcpy(&pan_scale_data[length], &mm_params.num_input_channels,
+ sizeof(mm_params.num_input_channels));
+ length += sizeof(mm_params.num_input_channels);
- pan_scale_data[length++] = mm_params.has_output_channel_map;
+ memcpy(&pan_scale_data[length], &mm_params.has_output_channel_map,
+ sizeof(mm_params.has_output_channel_map));
+ length += sizeof(mm_params.has_output_channel_map);
if (mm_params.has_output_channel_map &&
mm_params.num_output_channels <= MAX_CHANNELS_SUPPORTED &&
- mm_params.num_output_channels > 0)
- for (iter_i = 0; iter_i < mm_params.num_output_channels; iter_i++)
- pan_scale_data[length++] = mm_params.output_channel_map[iter_i];
- else {
+ mm_params.num_output_channels > 0) {
+ memcpy(&pan_scale_data[length], mm_params.output_channel_map,
+ (mm_params.num_output_channels * sizeof(mm_params.output_channel_map[0])));
+ length += (mm_params.num_output_channels * sizeof(mm_params.output_channel_map[0]));
+ } else {
ret = -EINVAL;
goto end;
}
- pan_scale_data[length++] = mm_params.has_input_channel_map;
+ memcpy(&pan_scale_data[length], &mm_params.has_input_channel_map,
+ sizeof(mm_params.has_input_channel_map));
+ length += sizeof(mm_params.has_input_channel_map);
if (mm_params.has_input_channel_map &&
mm_params.num_input_channels <= MAX_CHANNELS_SUPPORTED &&
- mm_params.num_input_channels > 0)
- for (iter_i = 0; iter_i < mm_params.num_input_channels; iter_i++)
- pan_scale_data[length++] = mm_params.input_channel_map[iter_i];
- else {
+ mm_params.num_input_channels > 0) {
+ memcpy(&pan_scale_data[length], mm_params.input_channel_map,
+ (mm_params.num_input_channels * sizeof(mm_params.input_channel_map[0])));
+ length += (mm_params.num_input_channels * sizeof(mm_params.input_channel_map[0]));
+ } else {
ret = -EINVAL;
goto end;
}
-
- pan_scale_data[length++] = mm_params.has_mixer_coeffs;
+ pan_scale_data[length] = mm_params.has_mixer_coeffs;
+ length += sizeof(mm_params.has_mixer_coeffs);
if (mm_params.has_mixer_coeffs)
for (iter_i = 0; iter_i < mm_params.num_output_channels; iter_i++)
- for (iter_j = 0; iter_j < mm_params.num_input_channels; iter_j++)
- pan_scale_data[length++] =
- mm_params.mixer_coeffs[iter_i][iter_j];
+ for (iter_j = 0; iter_j < mm_params.num_input_channels; iter_j++) {
+ memcpy(&pan_scale_data[length],
+ &mm_params.mixer_coeffs[iter_i][iter_j],
+ (sizeof(mm_params.mixer_coeffs[0][0])));
+ length += (sizeof(mm_params.mixer_coeffs[0][0]));
+ }
ret = mixer_ctl_set_array(ctl, pan_scale_data, length);
end:
+ if (pan_scale_data)
+ free(pan_scale_data);
return ret;
}
@@ -6496,20 +6511,13 @@
struct audio_device *adev = my_data->adev;
struct mixer_ctl *ctl;
char mixer_ctl_name[MIXER_PATH_MAX_LENGTH] = {0};
- int downmix_param_data[MAX_LENGTH_MIXER_CONTROL_IN_INT] = {0};
+ char *downmix_param_data = NULL;
int ret = 0;
int iter_i = 0;
int iter_j = 0;
int length = 0;
int be_idx = 0;
- if ((sizeof(mm_params) +
- sizeof(be_idx)) >
- MAX_LENGTH_MIXER_CONTROL_IN_INT) {
- ret = -EINVAL;
- goto end;
- }
-
snprintf(mixer_ctl_name, sizeof(mixer_ctl_name),
"Audio Device %d Downmix Control", snd_id);
ALOGD("%s mixer_ctl_name:%s", __func__, mixer_ctl_name);
@@ -6519,45 +6527,66 @@
ALOGE("%s: Could not get ctl for mixer cmd - %s",
__func__, mixer_ctl_name);
ret = -EINVAL;
- goto end;
}
+ downmix_param_data = (char *) calloc(1, sizeof(mm_params) + sizeof(be_idx));
+ if (!downmix_param_data) {
+ ret = -ENOMEM;
+ goto end;
+ }
be_idx = platform_get_snd_device_backend_index(snd_device);
- downmix_param_data[length] = be_idx;
- downmix_param_data[length++] = mm_params.num_output_channels;
- downmix_param_data[length++] = mm_params.num_input_channels;
+ memcpy(&downmix_param_data[length], &be_idx, sizeof(be_idx));
+ length += sizeof(be_idx);
+ memcpy(&downmix_param_data[length], &mm_params.num_output_channels,
+ sizeof(mm_params.num_output_channels));
+ length += sizeof(mm_params.num_output_channels);
+ memcpy(&downmix_param_data[length], &mm_params.num_input_channels,
+ sizeof(mm_params.num_input_channels));
+ length += sizeof(mm_params.num_input_channels);
- downmix_param_data[length++] = mm_params.has_output_channel_map;
+ memcpy(&downmix_param_data[length], &mm_params.has_output_channel_map,
+ sizeof(mm_params.has_output_channel_map));
+ length += sizeof(mm_params.has_output_channel_map);
if (mm_params.has_output_channel_map &&
mm_params.num_output_channels <= MAX_CHANNELS_SUPPORTED &&
- mm_params.num_output_channels > 0)
- for (iter_i = 0; iter_i < mm_params.num_output_channels; iter_i++)
- downmix_param_data[length++] = mm_params.output_channel_map[iter_i];
- else {
+ mm_params.num_output_channels > 0) {
+ memcpy(&downmix_param_data[length], mm_params.output_channel_map,
+ (mm_params.num_output_channels * sizeof(mm_params.output_channel_map[0])));
+ length += (mm_params.num_output_channels * sizeof(mm_params.output_channel_map[0]));
+ } else {
ret = -EINVAL;
goto end;
}
- downmix_param_data[length++] = mm_params.has_input_channel_map;
+ memcpy(&downmix_param_data[length], &mm_params.has_input_channel_map,
+ sizeof(mm_params.has_input_channel_map));
+ length += sizeof(mm_params.has_input_channel_map);
if (mm_params.has_input_channel_map &&
mm_params.num_input_channels <= MAX_CHANNELS_SUPPORTED &&
- mm_params.num_input_channels > 0)
- for (iter_i = 0; iter_i < mm_params.num_input_channels; iter_i++)
- downmix_param_data[length++] = mm_params.input_channel_map[iter_i];
- else {
+ mm_params.num_input_channels > 0) {
+ memcpy(&downmix_param_data[length], mm_params.input_channel_map,
+ (mm_params.num_input_channels * sizeof(mm_params.input_channel_map[0])));
+ length += (mm_params.num_input_channels * sizeof(mm_params.input_channel_map[0]));
+ } else {
ret = -EINVAL;
goto end;
}
-
- downmix_param_data[length++] = mm_params.has_mixer_coeffs;
+ memcpy(&downmix_param_data[length], &mm_params.has_mixer_coeffs,
+ sizeof(mm_params.has_mixer_coeffs));
+ length += sizeof(mm_params.has_mixer_coeffs);
if (mm_params.has_mixer_coeffs)
for (iter_i = 0; iter_i < mm_params.num_output_channels; iter_i++)
- for (iter_j = 0; iter_j < mm_params.num_input_channels; iter_j++)
- downmix_param_data[length++] =
- mm_params.mixer_coeffs[iter_i][iter_j];
+ for (iter_j = 0; iter_j < mm_params.num_input_channels; iter_j++) {
+ memcpy((uint32_t *) &downmix_param_data[length],
+ &mm_params.mixer_coeffs[iter_i][iter_j],
+ (sizeof(mm_params.mixer_coeffs[0][0])));
+ length += (sizeof(mm_params.mixer_coeffs[0][0]));
+ }
ret = mixer_ctl_set_array(ctl, downmix_param_data, length);
end:
+ if (downmix_param_data)
+ free(downmix_param_data);
return ret;
}
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index d385b4e..98c98d7 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -6250,7 +6250,7 @@
int iter_i = 0;
int iter_j = 0;
int length = 0;
- int *pan_scale_data = NULL;
+ char *pan_scale_data = NULL;
snprintf(mixer_ctl_name, sizeof(mixer_ctl_name),
"Audio Stream %d Pan Scale Control", snd_id);
@@ -6263,41 +6263,55 @@
ret = -EINVAL;
goto end;
}
- pan_scale_data = (int* ) calloc(1, sizeof(mm_params));
+ pan_scale_data = (char *) calloc(1, sizeof(mm_params));
if (!pan_scale_data) {
ret = -ENOMEM;
goto end;
}
- pan_scale_data[length++] = mm_params.num_output_channels;
- pan_scale_data[length++] = mm_params.num_input_channels;
+ memcpy(&pan_scale_data[length], &mm_params.num_output_channels,
+ sizeof(mm_params.num_output_channels));
+ length += sizeof(mm_params.num_output_channels);
+ memcpy(&pan_scale_data[length], &mm_params.num_input_channels,
+ sizeof(mm_params.num_input_channels));
+ length += sizeof(mm_params.num_input_channels);
- pan_scale_data[length++] = mm_params.has_output_channel_map;
+ memcpy(&pan_scale_data[length], &mm_params.has_output_channel_map,
+ sizeof(mm_params.has_output_channel_map));
+ length += sizeof(mm_params.has_output_channel_map);
if (mm_params.has_output_channel_map &&
mm_params.num_output_channels <= MAX_CHANNELS_SUPPORTED &&
- mm_params.num_output_channels > 0)
- for (iter_i = 0; iter_i < mm_params.num_output_channels; iter_i++)
- pan_scale_data[length++] = mm_params.output_channel_map[iter_i];
- else {
+ mm_params.num_output_channels > 0) {
+ memcpy(&pan_scale_data[length], mm_params.output_channel_map,
+ (mm_params.num_output_channels * sizeof(mm_params.output_channel_map[0])));
+ length += (mm_params.num_output_channels * sizeof(mm_params.output_channel_map[0]));
+ } else {
ret = -EINVAL;
goto end;
}
- pan_scale_data[length++] = mm_params.has_input_channel_map;
+ memcpy(&pan_scale_data[length], &mm_params.has_input_channel_map,
+ sizeof(mm_params.has_input_channel_map));
+ length += sizeof(mm_params.has_input_channel_map);
if (mm_params.has_input_channel_map &&
mm_params.num_input_channels <= MAX_CHANNELS_SUPPORTED &&
- mm_params.num_input_channels > 0)
- for (iter_i = 0; iter_i < mm_params.num_input_channels; iter_i++)
- pan_scale_data[length++] = mm_params.input_channel_map[iter_i];
- else {
+ mm_params.num_input_channels > 0) {
+ memcpy(&pan_scale_data[length], mm_params.input_channel_map,
+ (mm_params.num_input_channels * sizeof(mm_params.input_channel_map[0])));
+ length += (mm_params.num_input_channels * sizeof(mm_params.input_channel_map[0]));
+ } else {
ret = -EINVAL;
goto end;
}
- pan_scale_data[length++] = mm_params.has_mixer_coeffs;
+ pan_scale_data[length] = mm_params.has_mixer_coeffs;
+ length += sizeof(mm_params.has_mixer_coeffs);
if (mm_params.has_mixer_coeffs)
for (iter_i = 0; iter_i < mm_params.num_output_channels; iter_i++)
- for (iter_j = 0; iter_j < mm_params.num_input_channels; iter_j++)
- pan_scale_data[length++] =
- mm_params.mixer_coeffs[iter_i][iter_j];
+ for (iter_j = 0; iter_j < mm_params.num_input_channels; iter_j++) {
+ memcpy(&pan_scale_data[length],
+ &mm_params.mixer_coeffs[iter_i][iter_j],
+ (sizeof(mm_params.mixer_coeffs[0][0])));
+ length += (sizeof(mm_params.mixer_coeffs[0][0]));
+ }
ret = mixer_ctl_set_array(ctl, pan_scale_data, length);
end:
@@ -6315,7 +6329,7 @@
struct audio_device *adev = my_data->adev;
struct mixer_ctl *ctl;
char mixer_ctl_name[MIXER_PATH_MAX_LENGTH] = {0};
- int *downmix_param_data = NULL;
+ char *downmix_param_data = NULL;
int ret = 0;
int iter_i = 0;
int iter_j = 0;
@@ -6333,44 +6347,59 @@
ret = -EINVAL;
}
- downmix_param_data = (int* ) calloc(1, sizeof(mm_params) + sizeof(be_idx));
+ downmix_param_data = (char *) calloc(1, sizeof(mm_params) + sizeof(be_idx));
if (!downmix_param_data) {
ret = -ENOMEM;
goto end;
}
be_idx = platform_get_snd_device_backend_index(snd_device);
- downmix_param_data[length++] = be_idx;
- downmix_param_data[length++] = mm_params.num_output_channels;
- downmix_param_data[length++] = mm_params.num_input_channels;
+ memcpy(&downmix_param_data[length], &be_idx, sizeof(be_idx));
+ length += sizeof(be_idx);
+ memcpy(&downmix_param_data[length], &mm_params.num_output_channels,
+ sizeof(mm_params.num_output_channels));
+ length += sizeof(mm_params.num_output_channels);
+ memcpy(&downmix_param_data[length], &mm_params.num_input_channels,
+ sizeof(mm_params.num_input_channels));
+ length += sizeof(mm_params.num_input_channels);
- downmix_param_data[length++] = mm_params.has_output_channel_map;
+ memcpy(&downmix_param_data[length], &mm_params.has_output_channel_map,
+ sizeof(mm_params.has_output_channel_map));
+ length += sizeof(mm_params.has_output_channel_map);
if (mm_params.has_output_channel_map &&
mm_params.num_output_channels <= MAX_CHANNELS_SUPPORTED &&
- mm_params.num_output_channels > 0)
- for (iter_i = 0; iter_i < mm_params.num_output_channels; iter_i++)
- downmix_param_data[length++] = mm_params.output_channel_map[iter_i];
- else {
+ mm_params.num_output_channels > 0) {
+ memcpy(&downmix_param_data[length], mm_params.output_channel_map,
+ (mm_params.num_output_channels * sizeof(mm_params.output_channel_map[0])));
+ length += (mm_params.num_output_channels * sizeof(mm_params.output_channel_map[0]));
+ } else {
ret = -EINVAL;
goto end;
}
- downmix_param_data[length++] = mm_params.has_input_channel_map;
+ memcpy(&downmix_param_data[length], &mm_params.has_input_channel_map,
+ sizeof(mm_params.has_input_channel_map));
+ length += sizeof(mm_params.has_input_channel_map);
if (mm_params.has_input_channel_map &&
mm_params.num_input_channels <= MAX_CHANNELS_SUPPORTED &&
- mm_params.num_input_channels > 0)
- for (iter_i = 0; iter_i < mm_params.num_input_channels; iter_i++)
- downmix_param_data[length++] = mm_params.input_channel_map[iter_i];
- else {
+ mm_params.num_input_channels > 0) {
+ memcpy(&downmix_param_data[length], mm_params.input_channel_map,
+ (mm_params.num_input_channels * sizeof(mm_params.input_channel_map[0])));
+ length += (mm_params.num_input_channels * sizeof(mm_params.input_channel_map[0]));
+ } else {
ret = -EINVAL;
goto end;
}
-
- downmix_param_data[length++] = mm_params.has_mixer_coeffs;
+ memcpy(&downmix_param_data[length], &mm_params.has_mixer_coeffs,
+ sizeof(mm_params.has_mixer_coeffs));
+ length += sizeof(mm_params.has_mixer_coeffs);
if (mm_params.has_mixer_coeffs)
for (iter_i = 0; iter_i < mm_params.num_output_channels; iter_i++)
- for (iter_j = 0; iter_j < mm_params.num_input_channels; iter_j++)
- downmix_param_data[length++] =
- mm_params.mixer_coeffs[iter_i][iter_j];
+ for (iter_j = 0; iter_j < mm_params.num_input_channels; iter_j++) {
+ memcpy((uint32_t *) &downmix_param_data[length],
+ &mm_params.mixer_coeffs[iter_i][iter_j],
+ (sizeof(mm_params.mixer_coeffs[0][0])));
+ length += (sizeof(mm_params.mixer_coeffs[0][0]));
+ }
ret = mixer_ctl_set_array(ctl, downmix_param_data, length);
end:
diff --git a/qahw_api/inc/qahw_defs.h b/qahw_api/inc/qahw_defs.h
index c13a1a4..a301bf9 100644
--- a/qahw_api/inc/qahw_defs.h
+++ b/qahw_api/inc/qahw_defs.h
@@ -347,9 +347,9 @@
uint16_t num_output_channels;
uint16_t num_input_channels;
uint8_t has_output_channel_map;
- uint32_t output_channel_map[AUDIO_CHANNEL_COUNT_MAX];
+ uint16_t output_channel_map[AUDIO_CHANNEL_COUNT_MAX];
uint8_t has_input_channel_map;
- uint32_t input_channel_map[AUDIO_CHANNEL_COUNT_MAX];
+ uint16_t input_channel_map[AUDIO_CHANNEL_COUNT_MAX];
uint8_t has_mixer_coeffs;
float mixer_coeffs[AUDIO_CHANNEL_COUNT_MAX][AUDIO_CHANNEL_COUNT_MAX];
} qahw_mix_matrix_params_t;
diff --git a/qahw_api/test/qahw_playback_test.c b/qahw_api/test/qahw_playback_test.c
index 1338591..fc55f83 100644
--- a/qahw_api/test/qahw_playback_test.c
+++ b/qahw_api/test/qahw_playback_test.c
@@ -162,7 +162,7 @@
#endif
#ifndef AUDIO_OUTPUT_FLAG_INTERACTIVE
-#define AUDIO_OUTPUT_FLAG_INTERACTIVE 0x80000000
+#define AUDIO_OUTPUT_FLAG_INTERACTIVE 0x4000000
#endif
static bool request_wake_lock(bool wakelock_acquired, bool enable)
@@ -1830,7 +1830,7 @@
return channel_type;
}
-int extract_channel_mapping(uint32_t *channel_map, const char * arg_string){
+int extract_channel_mapping(uint16_t *channel_map, const char * arg_string){
char *token_string = NULL;
char *init_ptr = NULL;
diff --git a/qahw_api/test/qap_wrapper_extn.c b/qahw_api/test/qap_wrapper_extn.c
index 4c35711..d9f27d4 100644
--- a/qahw_api/test/qap_wrapper_extn.c
+++ b/qahw_api/test/qap_wrapper_extn.c
@@ -62,6 +62,7 @@
#define DEFAULT_SAMPLE_RATE 48000
#define MAX_QAP_MODULE_OUT 3
+extern bool stop_playback;
bool is_media_fmt_changed[MAX_QAP_MODULE_OUT];
int new_output_conf_index = 0;
@@ -1491,9 +1492,12 @@
buffer->common_params.offset = 0;
buffer->common_params.size = bytes_read;
memcpy(buffer->common_params.data, data_buf, bytes_read);
- if (bytes_read <= 0) {
+ if (bytes_read <= 0 || stop_playback) {
buffer->buffer_parms.input_buf_params.flags = QAP_BUFFER_EOS;
bytes_consumed = qap_module_process(qap_module_handle, buffer);
+ if (stop_playback)
+ qap_module_cmd(qap_module_handle, QAP_MODULE_CMD_FLUSH, sizeof(QAP_MODULE_CMD_FLUSH), NULL, NULL, NULL);
+
ret = qap_module_cmd(qap_module_handle, QAP_MODULE_CMD_STOP, sizeof(QAP_MODULE_CMD_STOP), NULL, NULL, NULL);
fprintf(stdout, "Stopped feeding input %s : %p\n", stream_info->filename, fp_input);
ALOGV("Stopped feeding input %s : %p", stream_info->filename, fp_input);
@@ -1546,7 +1550,7 @@
}
}
}
- } while (buffer->common_params.size > 0);
+ } while (buffer->common_params.size > 0 && !stop_playback);
if (reply_data)
free(reply_data);
buffer->common_params.data = temp_ptr;