Merge "configs: update mixer controls for sdm670"
diff --git a/configs/apq8098_latv/apq8098_latv.mk b/configs/apq8098_latv/apq8098_latv.mk
index 13f5882..242c6d5 100644
--- a/configs/apq8098_latv/apq8098_latv.mk
+++ b/configs/apq8098_latv/apq8098_latv.mk
@@ -123,117 +123,109 @@
# Low latency audio buffer size in frames
PRODUCT_PROPERTY_OVERRIDES += \
- audio_hal.period_size=192
+ vendor.audio_hal.period_size=192
##fluencetype can be "fluence" or "fluencepro" or "none"
PRODUCT_PROPERTY_OVERRIDES += \
-ro.qc.sdk.audio.fluencetype=none\
-persist.audio.fluence.voicecall=true\
-persist.audio.fluence.voicerec=false\
-persist.audio.fluence.speaker=true
+ro.vendor.audio.sdk.fluencetype=none\
+persist.vendor.audio.fluence.voicecall=true\
+persist.vendor.audio.fluence.voicerec=false\
+persist.vendor.audio.fluence.speaker=true
#disable tunnel encoding
PRODUCT_PROPERTY_OVERRIDES += \
-tunnel.audio.encode=false
+vendor.audio.tunnel.encode=false
#Disable RAS Feature by default
PRODUCT_PROPERTY_OVERRIDES += \
-persist.audio.ras.enabled=false
+persist.vendor.audio.ras.enabled=false
#Buffer size in kbytes for compress offload playback
PRODUCT_PROPERTY_OVERRIDES += \
-audio.offload.buffer.size.kb=32
+vendor.audio.offload.buffer.size.kb=32
#Enable offload audio video playback by default
PRODUCT_PROPERTY_OVERRIDES += \
audio.offload.video=true
-#Enable 16 bit PCM offload by default
-PRODUCT_PROPERTY_OVERRIDES += \
-audio.offload.pcm.16bit.enable=true
-
-#Enable 24 bit PCM offload by default
-PRODUCT_PROPERTY_OVERRIDES += \
-audio.offload.pcm.24bit.enable=true
-
#Enable audio track offload by default
PRODUCT_PROPERTY_OVERRIDES += \
-audio.offload.track.enable=true
+vendor.audio.offload.track.enable=true
#Enable music through deep buffer
PRODUCT_PROPERTY_OVERRIDES += \
audio.deep_buffer.media=true
-#QC property used when calculating client heap size in audio flinger
-PRODUCT_PROPERTY_OVERRIDES += \
-audio.heap.size.multiplier=7
-
#enable voice path for PCM VoIP by default
PRODUCT_PROPERTY_OVERRIDES += \
-use.voice.path.for.pcm.voip=true
+vendor.voice.path.for.pcm.voip=true
#Enable multi channel aac through offload
PRODUCT_PROPERTY_OVERRIDES += \
-audio.offload.multiaac.enable=true
+vendor.audio.offload.multiaac.enable=true
#Enable DS2, Hardbypass feature for Dolby
PRODUCT_PROPERTY_OVERRIDES += \
-audio.dolby.ds2.enabled=false\
-audio.dolby.ds2.hardbypass=false
+vendor.audio.dolby.ds2.enabled=false\
+vendor.audio.dolby.ds2.hardbypass=false
#Disable Multiple offload sesison
PRODUCT_PROPERTY_OVERRIDES += \
-audio.offload.multiple.enabled=false
+vendor.audio.offload.multiple.enabled=false
#Disable Compress passthrough playback
PRODUCT_PROPERTY_OVERRIDES += \
-audio.offload.passthrough=false
+vendor.audio.offload.passthrough=false
#Disable surround sound recording
PRODUCT_PROPERTY_OVERRIDES += \
-ro.qc.sdk.audio.ssr=false
+ro.vendor.audio.sdk.ssr=false
#enable dsp gapless mode by default
PRODUCT_PROPERTY_OVERRIDES += \
-audio.offload.gapless.enabled=true
+vendor.audio.offload.gapless.enabled=true
#enable pbe effects
PRODUCT_PROPERTY_OVERRIDES += \
-audio.safx.pbe.enabled=true
+vendor.audio.safx.pbe.enabled=true
#parser input buffer size(256kb) in byte stream mode
PRODUCT_PROPERTY_OVERRIDES += \
-audio.parser.ip.buffer.size=262144
+vendor.audio.parser.ip.buffer.size=262144
#flac sw decoder 24 bit decode capability
PRODUCT_PROPERTY_OVERRIDES += \
-flac.sw.decoder.24bit.support=true
+vendor.audio.flac.sw.decoder.24bit=true
#split a2dp DSP supported encoder list
PRODUCT_PROPERTY_OVERRIDES += \
-persist.bt.a2dp_offload_cap=sbc-aptx-aptxhd-aac
+persist.vendor.bt.a2dp_offload_cap=sbc-aptx-aptxhd-aac
#enable software decoders for ALAC and APE
PRODUCT_PROPERTY_OVERRIDES += \
-use.qti.sw.alac.decoder=true
+vendor.audio.use.sw.alac.decoder=true
PRODUCT_PROPERTY_OVERRIDES += \
-use.qti.sw.ape.decoder=true
+vendor.audio.use.sw.ape.decoder=true
#enable hw aac encoder by default
PRODUCT_PROPERTY_OVERRIDES += \
-qcom.hw.aac.encoder=true
+vendor.audio.hw.aac.encoder=true
#Disable FM a2dp concurrency
PRODUCT_PROPERTY_OVERRIDES += \
-fm.a2dp.conc.disabled=true
+vendor.fm.a2dp.conc.disabled=true
#audio becoming noisy intent broadcast delay
PRODUCT_PROPERTY_OVERRIDES += \
-audio.noisy.broadcast.delay=600
+vendor.audio.noisy.broadcast.delay=600
#offload pausetime out duration to 3 secs to inline with other outputs
PRODUCT_PROPERTY_OVERRIDES += \
-audio.offload.pstimeout.secs=3
+vendor.audio.offload.pstimeout.secs=3
+
+#Set AudioFlinger client heap size
+PRODUCT_PROPERTY_OVERRIDES += \
+ro.af.client_heap_size_kbyte=7168
# for HIDL related packages
PRODUCT_PACKAGES += \
diff --git a/configs/apq8098_latv/audio_policy_configuration.xml b/configs/apq8098_latv/audio_policy_configuration.xml
index fafd322..c8707e3 100644
--- a/configs/apq8098_latv/audio_policy_configuration.xml
+++ b/configs/apq8098_latv/audio_policy_configuration.xml
@@ -329,7 +329,7 @@
<route type="mix" sink="voice_rx"
sources="Telephony Rx"/>
<route type="mix" sink="primary input"
- sources="Wired Headset Mic,BT SCO Headset Mic,FM Tuner,USB Device In,Telephony Rx"/>
+ sources="Built-In Mic,Wired Headset Mic,BT SCO Headset Mic,FM Tuner,USB Device In,Telephony Rx"/>
<route type="mix" sink="surround_sound"
sources="Built-In Mic,Built-In Back Mic"/>
<route type="mix" sink="record_24"
diff --git a/configs/msm8937/audio_policy_configuration.xml b/configs/msm8937/audio_policy_configuration.xml
index 73f9198..b2b26a2 100644
--- a/configs/msm8937/audio_policy_configuration.xml
+++ b/configs/msm8937/audio_policy_configuration.xml
@@ -260,7 +260,7 @@
<route type="mix" sink="Telephony Tx"
sources="voice_tx"/>
<route type="mix" sink="primary input"
- sources="Built-In Mic,Wired Headset Mic,BT SCO Headset Mic,FM Tuner,Telephony Rx"/>
+ sources="Wired Headset Mic,BT SCO Headset Mic,FM Tuner,Telephony Rx"/>
<route type="mix" sink="surround_sound"
sources="Built-In Mic,Built-In Back Mic"/>
<route type="mix" sink="voice_rx"
diff --git a/configs/msm8937/msm8937.mk b/configs/msm8937/msm8937.mk
index 98df9d2..6200705 100644
--- a/configs/msm8937/msm8937.mk
+++ b/configs/msm8937/msm8937.mk
@@ -224,6 +224,10 @@
PRODUCT_PROPERTY_OVERRIDES += \
vendor.audio.flac.sw.decoder.24bit=true
+#Set AudioFlinger client heap size
+PRODUCT_PROPERTY_OVERRIDES += \
+ro.af.client_heap_size_kbyte=7168
+
# for HIDL related packages
PRODUCT_PACKAGES += \
android.hardware.audio@2.0-service \
diff --git a/configs/msm8953/audio_policy_configuration.xml b/configs/msm8953/audio_policy_configuration.xml
index cfaa3e2..424a436 100644
--- a/configs/msm8953/audio_policy_configuration.xml
+++ b/configs/msm8953/audio_policy_configuration.xml
@@ -271,7 +271,7 @@
<route type="mix" sink="Telephony Tx"
sources="voice_tx"/>
<route type="mix" sink="primary input"
- sources="Built-In Mic,Wired Headset Mic,BT SCO Headset Mic,FM Tuner,Telephony Rx"/>
+ sources="Wired Headset Mic,BT SCO Headset Mic,FM Tuner,Telephony Rx"/>
<route type="mix" sink="surround_sound"
sources="Built-In Mic,Built-In Back Mic"/>
<route type="mix" sink="record_24"
diff --git a/configs/msm8953/msm8953.mk b/configs/msm8953/msm8953.mk
index 56342f7..068317d 100644
--- a/configs/msm8953/msm8953.mk
+++ b/configs/msm8953/msm8953.mk
@@ -223,6 +223,10 @@
PRODUCT_PROPERTY_OVERRIDES += \
vendor.audio.flac.sw.decoder.24bit=true
+#Set AudioFlinger client heap size
+PRODUCT_PROPERTY_OVERRIDES += \
+ro.af.client_heap_size_kbyte=7168
+
# for HIDL related packages
PRODUCT_PACKAGES += \
android.hardware.audio@2.0-service \
diff --git a/configs/msm8996/audio_policy_configuration.xml b/configs/msm8996/audio_policy_configuration.xml
index 7b8dbae..815f071 100644
--- a/configs/msm8996/audio_policy_configuration.xml
+++ b/configs/msm8996/audio_policy_configuration.xml
@@ -271,7 +271,7 @@
<route type="mix" sink="Telephony Tx"
sources="voice_tx"/>
<route type="mix" sink="primary input"
- sources="Built-In Mic,Wired Headset Mic,BT SCO Headset Mic,FM Tuner,Telephony Rx"/>
+ sources="Wired Headset Mic,BT SCO Headset Mic,FM Tuner,Telephony Rx"/>
<route type="mix" sink="surround_sound"
sources="Built-In Mic,Built-In Back Mic"/>
<route type="mix" sink="record_24"
diff --git a/configs/msm8996/msm8996.mk b/configs/msm8996/msm8996.mk
index 69c5c1b..2b815ae 100644
--- a/configs/msm8996/msm8996.mk
+++ b/configs/msm8996/msm8996.mk
@@ -189,6 +189,10 @@
PRODUCT_PROPERTY_OVERRIDES += \
vendor.audio.flac.sw.decoder.24bit=true
+#Set AudioFlinger client heap size
+PRODUCT_PROPERTY_OVERRIDES += \
+ro.af.client_heap_size_kbyte=7168
+
# for HIDL related packages
PRODUCT_PACKAGES += \
android.hardware.audio@2.0-service \
diff --git a/configs/msm8998/audio_policy_configuration.xml b/configs/msm8998/audio_policy_configuration.xml
index ff0820e..e084bba 100644
--- a/configs/msm8998/audio_policy_configuration.xml
+++ b/configs/msm8998/audio_policy_configuration.xml
@@ -335,7 +335,7 @@
<route type="mix" sink="voice_rx"
sources="Telephony Rx"/>
<route type="mix" sink="primary input"
- sources="Built-In Mic,Wired Headset Mic,BT SCO Headset Mic,FM Tuner,USB Device In,Telephony Rx"/>
+ sources="Wired Headset Mic,BT SCO Headset Mic,FM Tuner,USB Device In,Telephony Rx"/>
<route type="mix" sink="surround_sound"
sources="Built-In Mic,Built-In Back Mic"/>
<route type="mix" sink="record_24"
diff --git a/configs/msm8998/msm8998.mk b/configs/msm8998/msm8998.mk
index 9d77482..dd68841 100644
--- a/configs/msm8998/msm8998.mk
+++ b/configs/msm8998/msm8998.mk
@@ -223,6 +223,10 @@
PRODUCT_PROPERTY_OVERRIDES += \
vendor.audio.offload.pstimeout.secs=3
+#Set AudioFlinger client heap size
+PRODUCT_PROPERTY_OVERRIDES += \
+ro.af.client_heap_size_kbyte=7168
+
# for HIDL related packages
PRODUCT_PACKAGES += \
android.hardware.audio@2.0-service \
diff --git a/configs/sdm660/audio_policy_configuration.xml b/configs/sdm660/audio_policy_configuration.xml
index 09a4bb9..9a67a32 100644
--- a/configs/sdm660/audio_policy_configuration.xml
+++ b/configs/sdm660/audio_policy_configuration.xml
@@ -326,7 +326,7 @@
<route type="mix" sink="voice_rx"
sources="Telephony Rx"/>
<route type="mix" sink="primary input"
- sources="Built-In Mic,Wired Headset Mic,BT SCO Headset Mic,FM Tuner,USB Device In,Telephony Rx"/>
+ sources="Wired Headset Mic,BT SCO Headset Mic,FM Tuner,USB Device In,Telephony Rx"/>
<route type="mix" sink="surround_sound"
sources="Built-In Mic,Built-In Back Mic"/>
<route type="mix" sink="record_24"
diff --git a/configs/sdm660/sdm660.mk b/configs/sdm660/sdm660.mk
index bddc56e..8d57a46 100644
--- a/configs/sdm660/sdm660.mk
+++ b/configs/sdm660/sdm660.mk
@@ -234,6 +234,10 @@
PRODUCT_PROPERTY_OVERRIDES += \
vendor.audio.offload.pstimeout.secs=3
+#Set AudioFlinger client heap size
+PRODUCT_PROPERTY_OVERRIDES += \
+ro.af.client_heap_size_kbyte=7168
+
# for HIDL related packages
PRODUCT_PACKAGES += \
android.hardware.audio@2.0-service \
diff --git a/configs/sdm845/audio_policy_configuration.xml b/configs/sdm845/audio_policy_configuration.xml
index 655919b..d775641 100644
--- a/configs/sdm845/audio_policy_configuration.xml
+++ b/configs/sdm845/audio_policy_configuration.xml
@@ -335,7 +335,7 @@
<route type="mix" sink="voice_rx"
sources="Telephony Rx"/>
<route type="mix" sink="primary input"
- sources="Built-In Mic,Wired Headset Mic,BT SCO Headset Mic,FM Tuner,USB Device In,Telephony Rx"/>
+ sources="Wired Headset Mic,BT SCO Headset Mic,FM Tuner,USB Device In,Telephony Rx"/>
<route type="mix" sink="surround_sound"
sources="Built-In Mic,Built-In Back Mic"/>
<route type="mix" sink="record_24"
diff --git a/configs/sdm845/sdm845.mk b/configs/sdm845/sdm845.mk
index 56f248b..92c22de 100644
--- a/configs/sdm845/sdm845.mk
+++ b/configs/sdm845/sdm845.mk
@@ -212,6 +212,10 @@
PRODUCT_PROPERTY_OVERRIDES += \
vendor.audio.offload.pstimeout.secs=3
+#Set AudioFlinger client heap size
+PRODUCT_PROPERTY_OVERRIDES += \
+ro.af.client_heap_size_kbyte=7168
+
# for HIDL related packages
PRODUCT_PACKAGES += \
android.hardware.audio@2.0-service \
diff --git a/configs/sdm845/sound_trigger_mixer_paths_wcd9340.xml b/configs/sdm845/sound_trigger_mixer_paths_wcd9340.xml
index d876fa7..676ae95 100644
--- a/configs/sdm845/sound_trigger_mixer_paths_wcd9340.xml
+++ b/configs/sdm845/sound_trigger_mixer_paths_wcd9340.xml
@@ -47,6 +47,10 @@
<ctl name="SLIMBUS_5_TX LSM Function" value="None" />
<ctl name="MADONOFF Switch" value="0" />
<ctl name="MAD Input" value="DMIC1" />
+ <ctl name="MAD_SEL MUX" value="SPE" />
+ <ctl name="MAD_INP MUX" value="DEC1" />
+ <ctl name="MAD_CPE1 Switch" value="0" />
+ <ctl name="CDC_IF TX13 MUX" value="ZERO" />
<ctl name="MAD_BROADCAST Switch" value="0" />
<ctl name="TX13 INP MUX" value="CDC_DEC_5" />
<ctl name="AIF4_MAD Mixer SLIM TX12" value="0" />
diff --git a/hal/audio_extn/a2dp.c b/hal/audio_extn/a2dp.c
index 2103930..9ebc0f2 100644
--- a/hal/audio_extn/a2dp.c
+++ b/hal/audio_extn/a2dp.c
@@ -1038,6 +1038,7 @@
a2dp.enc_sampling_rate = 48000;
a2dp.is_a2dp_offload_supported = false;
a2dp.is_handoff_in_progress = false;
+ reset_a2dp_enc_config_params();
update_offload_codec_capabilities();
}
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index 2726d40..c30f982 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -96,7 +96,7 @@
#endif
#ifndef AUDIO_FORMAT_AC4
-#define AUDIO_FORMAT_AC4 0x23000000UL
+#define AUDIO_FORMAT_AC4 0x22000000UL
#endif
#ifndef AUDIO_OUTPUT_FLAG_MAIN
diff --git a/hal/audio_extn/qaf.c b/hal/audio_extn/qaf.c
index a44d3d6..6320b94 100644
--- a/hal/audio_extn/qaf.c
+++ b/hal/audio_extn/qaf.c
@@ -1669,12 +1669,14 @@
}
DEBUG_MSG_VV("Bytes written = %d", ret);
}
- else if (event_id == AUDIO_EOS_MAIN_DD_DDP_EVENT
+ else if (event_id == AUDIO_EOS_EVENT
+ || event_id == AUDIO_EOS_MAIN_DD_DDP_EVENT
|| event_id == AUDIO_EOS_MAIN_2_DD_DDP_EVENT
|| event_id == AUDIO_EOS_MAIN_AAC_EVENT
|| event_id == AUDIO_EOS_MAIN_AC4_EVENT
|| event_id == AUDIO_EOS_ASSOC_DD_DDP_EVENT) {
struct stream_out *out = qaf_mod->stream_in[QAF_IN_MAIN];
+ struct stream_out *out_pcm = qaf_mod->stream_in[QAF_IN_PCM];
struct stream_out *out_main2 = qaf_mod->stream_in[QAF_IN_MAIN_2];
struct stream_out *out_assoc = qaf_mod->stream_in[QAF_IN_ASSOC];
@@ -1682,7 +1684,16 @@
* TODO:: Only DD/DDP Associate Eos is handled, need to add support
* for other formats.
*/
- if (event_id == AUDIO_EOS_ASSOC_DD_DDP_EVENT
+ if (event_id == AUDIO_EOS_EVENT
+ && (out_pcm != NULL)
+ && (check_stream_state(out_pcm, STOPPING))) {
+
+ lock_output_stream(out_pcm);
+ out_pcm->client_callback(STREAM_CBK_EVENT_DRAIN_READY, NULL, out_pcm->client_cookie);
+ set_stream_state(out_pcm, STOPPED);
+ unlock_output_stream(out_pcm);
+ DEBUG_MSG("sent pcm DRAIN_READY");
+ } else if (event_id == AUDIO_EOS_ASSOC_DD_DDP_EVENT
&& (out_assoc != NULL)
&& (check_stream_state(out_assoc, STOPPING))) {
diff --git a/hal/audio_extn/spkr_protection.c b/hal/audio_extn/spkr_protection.c
index 3784197..a33d432 100644
--- a/hal/audio_extn/spkr_protection.c
+++ b/hal/audio_extn/spkr_protection.c
@@ -430,6 +430,20 @@
return -EINVAL;
}
+void destroy_thread_params()
+{
+ pthread_mutex_destroy(&handle.mutex_spkr_prot);
+ pthread_mutex_destroy(&handle.spkr_calib_cancelack_mutex);
+ pthread_mutex_destroy(&handle.cal_wait_cond_mutex);
+ pthread_cond_destroy(&handle.cal_wait_condition);
+ pthread_cond_destroy(&handle.spkr_calib_cancel);
+ pthread_cond_destroy(&handle.spkr_calibcancel_ack);
+ if(!handle.wsa_found) {
+ pthread_mutex_destroy(&handle.spkr_prot_thermalsync_mutex);
+ pthread_cond_destroy(&handle.spkr_prot_thermalsync);
+ }
+}
+
static int spkr_calibrate(int t0_spk_1, int t0_spk_2)
{
struct audio_device *adev = handle.adev_handle;
@@ -443,6 +457,7 @@
bool acquire_device = false;
status.status = 0;
+ memset(&protCfg, 0, sizeof(protCfg));
if (!adev) {
ALOGE("%s: Invalid params", __func__);
return -EINVAL;
@@ -1314,11 +1329,7 @@
handle.init_check = true;
} else {
ALOGE("%s: speaker calibration thread creation failed", __func__);
- pthread_mutex_destroy(&handle.mutex_spkr_prot);
- pthread_mutex_destroy(&handle.spkr_calib_cancelack_mutex);
- pthread_mutex_destroy(&handle.cal_wait_cond_mutex);
- pthread_cond_destroy(&handle.spkr_calib_cancel);
- pthread_cond_destroy(&handle.spkr_calibcancel_ack);
+ destroy_thread_params();
}
return;
} else {
@@ -1366,13 +1377,7 @@
handle.init_check = true;
} else {
ALOGE("%s: speaker calibration thread creation failed", __func__);
- pthread_mutex_destroy(&handle.mutex_spkr_prot);
- pthread_mutex_destroy(&handle.spkr_calib_cancelack_mutex);
- pthread_mutex_destroy(&handle.cal_wait_cond_mutex);
- pthread_cond_destroy(&handle.spkr_calib_cancel);
- pthread_cond_destroy(&handle.spkr_calibcancel_ack);
- pthread_mutex_destroy(&handle.spkr_prot_thermalsync_mutex);
- pthread_cond_destroy(&handle.spkr_prot_thermalsync);
+ destroy_thread_params();
}
} else {
ALOGE("%s: thermal_client_request failed", __func__);
@@ -1400,7 +1405,8 @@
{
int result = 0;
- ALOGD("%s: Entering deinit init_check :%d", __func__, handle.init_check);
+ ALOGD("%s: Entering deinit init_check :%d",
+ __func__, handle.init_check);
if(!handle.init_check)
return -1;
@@ -1411,15 +1417,7 @@
ALOGE("%s:Unable to join the calibration thread", __func__);
return -1;
}
- pthread_mutex_destroy(&handle.mutex_spkr_prot);
- pthread_mutex_destroy(&handle.spkr_calib_cancelack_mutex);
- pthread_mutex_destroy(&handle.cal_wait_cond_mutex);
- pthread_cond_destroy(&handle.spkr_calib_cancel);
- pthread_cond_destroy(&handle.spkr_calibcancel_ack);
- if(!handle.wsa_found) {
- pthread_mutex_destroy(&handle.spkr_prot_thermalsync_mutex);
- pthread_cond_destroy(&handle.spkr_prot_thermalsync);
- }
+ destroy_thread_params();
memset(&handle, 0, sizeof(handle));
return 0;
}
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index 4615de8..8545d3a 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -986,7 +986,7 @@
if (s_info->flags.out_flags == AUDIO_OUTPUT_FLAG_DIRECT)
direct_app_type = s_info->app_type_cfg.app_type;
}
- if (usecase->stream.out->flags == AUDIO_OUTPUT_FLAG_INTERACTIVE)
+ if (usecase->stream.out->flags & AUDIO_OUTPUT_FLAG_INTERACTIVE)
app_type = direct_app_type;
else
app_type = usecase->stream.out->app_type_cfg.app_type;
@@ -1244,7 +1244,8 @@
*be multiple of (number of channels * bytes per sample)
*For writes to succeed, the buffer must be written at address which is multiple of 32
*/
- fragment_size = ALIGN(fragment_size, (bytes_per_sample * noOfChannels * 32));
+ fragment_size = ALIGN(fragment_size, (bytes_per_sample * noOfChannels));
+ fragment_size = ALIGN(fragment_size, 32);
ALOGI("PCM offload Fragment size to %d bytes", fragment_size);
return fragment_size;
@@ -2301,7 +2302,7 @@
int ret = -EINVAL, i = 0, j = 0;
struct audio_usecase *usecase = NULL;
- if (mm_params == NULL && out != NULL) {
+ if (mm_params == NULL || out == NULL) {
ALOGE("%s:: Invalid mix matrix params", __func__);
goto exit;
}
@@ -2313,6 +2314,11 @@
goto exit;
usecase = get_usecase_from_list(out->dev, out->usecase);
+ if (usecase == NULL) {
+ ALOGE("%s: Invalid usecase", __func__);
+ goto exit;
+ }
+
out->downmix_params.num_output_channels = mm_params->num_output_channels;
out->downmix_params.num_input_channels = mm_params->num_input_channels;
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 12bc76b..6653f6a 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -403,6 +403,7 @@
static int check_a2dp_restore_l(struct audio_device *adev, struct stream_out *out, bool restore);
static int out_set_compr_volume(struct audio_stream_out *stream, float left, float right);
+static int out_set_voip_volume(struct audio_stream_out *stream, float left, float right);
static bool may_use_noirq_mode(struct audio_device *adev, audio_usecase_t uc_id,
int flags __unused)
@@ -2737,7 +2738,9 @@
}
platform_set_stream_channel_map(adev->platform, out->channel_mask,
out->pcm_device_id, &out->channel_map_param.channel_map[0]);
-
+ // apply volume for voip playback after path is set up
+ if (out->usecase == USECASE_AUDIO_PLAYBACK_VOIP)
+ out_set_voip_volume(&out->stream, out->volume_l, out->volume_r);
} else {
platform_set_stream_channel_map(adev->platform, out->channel_mask,
out->pcm_device_id, &out->channel_map_param.channel_map[0]);
@@ -2794,6 +2797,10 @@
if (ret == 0) {
register_out_stream(out);
if (out->realtime) {
+ if (out->pcm == NULL || !pcm_is_ready(out->pcm)) {
+ ALOGE("%s: pcm stream not ready", __func__);
+ goto error_open;
+ }
ret = pcm_start(out->pcm);
if (ret < 0)
goto error_open;
@@ -3620,6 +3627,31 @@
return 0;
}
+static int out_set_voip_volume(struct audio_stream_out *stream, float left,
+ float right)
+{
+ struct stream_out *out = (struct stream_out *)stream;
+ char mixer_ctl_name[] = "App Type Gain";
+ struct audio_device *adev = out->dev;
+ struct mixer_ctl *ctl;
+ uint32_t set_values[4];
+
+ ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
+ if (!ctl) {
+ ALOGE("%s: Could not get ctl for mixer cmd - %s",
+ __func__, mixer_ctl_name);
+ return -EINVAL;
+ }
+
+ set_values[0] = 0; //0: Rx Session 1:Tx Session
+ set_values[1] = out->app_type_cfg.app_type;
+ set_values[2] = (int)(left * VOIP_PLAYBACK_VOLUME_MAX);
+ set_values[3] = (int)(right * VOIP_PLAYBACK_VOLUME_MAX);
+
+ mixer_ctl_set_array(ctl, set_values, ARRAY_SIZE(set_values));
+ return 0;
+}
+
static int out_set_volume(struct audio_stream_out *stream, float left,
float right)
{
@@ -3664,25 +3696,11 @@
return ret;
}
} else if (out->usecase == USECASE_AUDIO_PLAYBACK_VOIP) {
- char mixer_ctl_name[] = "App Type Gain";
- struct audio_device *adev = out->dev;
- struct mixer_ctl *ctl;
- uint32_t set_values[4];
-
- ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
- if (!ctl) {
- ALOGE("%s: Could not get ctl for mixer cmd - %s",
- __func__, mixer_ctl_name);
- return -EINVAL;
- }
-
- set_values[0] = 0; //0: Rx Session 1:Tx Session
- set_values[1] = out->app_type_cfg.app_type;
- set_values[2] = (int)(left * VOIP_PLAYBACK_VOLUME_MAX);
- set_values[3] = (int)(right * VOIP_PLAYBACK_VOLUME_MAX);
-
- mixer_ctl_set_array(ctl, set_values, ARRAY_SIZE(set_values));
- return 0;
+ if (!out->standby)
+ ret = out_set_voip_volume(stream, left, right);
+ out->volume_l = left;
+ out->volume_r = right;
+ return ret;
}
return -ENOSYS;
@@ -4883,8 +4901,8 @@
struct stream_in *in = (struct stream_in *)stream;
struct audio_device *adev = in->dev;
int ret = 0;
- unsigned int offset1;
- unsigned int frames1;
+ unsigned int offset1 = 0;
+ unsigned int frames1 = 0;
const char *step = "";
pthread_mutex_lock(&adev->lock);
diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h
index 80aee77..b5bbbdf 100644
--- a/hal/msm8974/platform.h
+++ b/hal/msm8974/platform.h
@@ -298,7 +298,7 @@
/* Used in calculating fragment size for pcm offload */
-#define PCM_OFFLOAD_BUFFER_DURATION 40 /* 40 millisecs */
+#define PCM_OFFLOAD_BUFFER_DURATION 80 /* 80 millisecs */
/* MAX PCM fragment size cannot be increased further due
* to flinger's cblk size of 1mb,and it has to be a multiple of
diff --git a/post_proc/equalizer.c b/post_proc/equalizer.c
index 45f8eb8..c1c1303 100644
--- a/post_proc/equalizer.c
+++ b/post_proc/equalizer.c
@@ -366,6 +366,7 @@
equalizer_context_t *eq_ctxt = (equalizer_context_t *)context;
int voffset = ((p->psize - 1) / sizeof(int32_t) + 1) * sizeof(int32_t);
void *value = p->data + voffset;
+ int32_t vsize = (int32_t) p->vsize;
int32_t *param_tmp = (int32_t *)p->data;
int32_t param = *param_tmp++;
int32_t preset;
@@ -379,6 +380,10 @@
switch (param) {
case EQ_PARAM_CUR_PRESET:
+ if (vsize < sizeof(int16_t)) {
+ p->status = -EINVAL;
+ break;
+ }
preset = (int32_t)(*(uint16_t *)value);
if ((preset >= equalizer_get_num_presets(eq_ctxt)) || (preset < 0)) {
@@ -388,6 +393,10 @@
equalizer_set_preset(eq_ctxt, preset);
break;
case EQ_PARAM_BAND_LEVEL:
+ if (vsize < sizeof(int16_t)) {
+ p->status = -EINVAL;
+ break;
+ }
band = *param_tmp;
level = (int32_t)(*(int16_t *)value);
if (band < 0 || band >= NUM_EQ_BANDS) {
@@ -401,6 +410,10 @@
equalizer_set_band_level(eq_ctxt, band, level);
break;
case EQ_PARAM_PROPERTIES: {
+ if (vsize < sizeof(int16_t)) {
+ p->status = -EINVAL;
+ break;
+ }
int16_t *prop = (int16_t *)value;
if ((int)prop[0] >= equalizer_get_num_presets(eq_ctxt)) {
p->status = -EINVAL;
@@ -409,6 +422,13 @@
if (prop[0] >= 0) {
equalizer_set_preset(eq_ctxt, (int)prop[0]);
} else {
+ if (vsize < (2 + NUM_EQ_BANDS) * sizeof(int16_t)) {
+ android_errorWriteLog(0x534e4554, "37563371");
+ ALOGE("\tERROR EQ_PARAM_PROPERTIES valueSize %d < %d",
+ vsize, (2 + NUM_EQ_BANDS) * sizeof(int16_t));
+ p->status = -EINVAL;
+ break;
+ }
if ((int)prop[1] != NUM_EQ_BANDS) {
p->status = -EINVAL;
break;