summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2014-12-23 12:33:26 -0800
committerSteve Kondik <steve@cyngn.com>2014-12-23 12:33:26 -0800
commit341ab356ca5d12612389160cb60c049bcf418852 (patch)
treee4a507ca49a67b0726c4119f4dbed2b949987fe5
parent2a168d1bdfe5daccb5ecbcc13a67bcc7c579a63a (diff)
downloadandroid_hardware_qcom_audio-341ab356ca5d12612389160cb60c049bcf418852.tar.gz
android_hardware_qcom_audio-341ab356ca5d12612389160cb60c049bcf418852.tar.bz2
android_hardware_qcom_audio-341ab356ca5d12612389160cb60c049bcf418852.zip
hal: Fix issues with app type config during device verification
* Don't try to send the app type config during verification as the streams aren't set up yet and will crash due to null pointers. Change-Id: Ic4cdd5374b46b3e3c2042b158820af5ec020e754
-rw-r--r--hal/audio_extn/utils.c12
-rw-r--r--hal/audio_hw.c5
2 files changed, 13 insertions, 4 deletions
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index 724bf8e2..d364eb8f 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -451,7 +451,7 @@ void audio_extn_utils_update_stream_app_type_cfg(void *platform,
__func__, flags, format, sample_rate);
list_for_each(node_i, streams_output_cfg_list) {
so_info = node_to_item(node_i, struct streams_output_cfg, list);
- if (so_info->flags == flags) {
+ if (so_info != NULL && so_info->flags == flags) {
list_for_each(node_j, &so_info->format_list) {
sf_info = node_to_item(node_j, struct stream_format, list);
if (sf_info->format == format) {
@@ -463,7 +463,7 @@ void audio_extn_utils_update_stream_app_type_cfg(void *platform,
}
list_for_each(node_i, streams_output_cfg_list) {
so_info = node_to_item(node_i, struct streams_output_cfg, list);
- if (so_info->flags == AUDIO_OUTPUT_FLAG_PRIMARY) {
+ if (so_info != NULL && so_info->flags == AUDIO_OUTPUT_FLAG_PRIMARY) {
ALOGV("Compatible output profile not found.");
app_type_cfg->app_type = so_info->app_type_cfg.app_type;
app_type_cfg->sample_rate = so_info->app_type_cfg.sample_rate;
@@ -507,10 +507,18 @@ int audio_extn_utils_send_app_type_cfg(struct audio_usecase *usecase)
out = usecase->stream.out;
adev = out->dev;
+ if (adev == NULL) {
+ ALOGE("Device not ready, skip app type update");
+ rc = 0;
+ goto exit_send_app_type_cfg;
+ }
+
snd_device = usecase->out_snd_device;
pcm_device_id = platform_get_pcm_device_id(out->usecase, PCM_PLAYBACK);
+ ALOGV("%s: usecase=%d pcm_device_id=%d", __func__, usecase->id, pcm_device_id);
+
snprintf(mixer_ctl_name, sizeof(mixer_ctl_name),
"Audio Stream %d App Type Cfg", pcm_device_id);
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index b9b22f19..1b299d64 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -3564,8 +3564,6 @@ static int adev_open(const hw_module_t *module, const char *name,
adev->bt_wb_speech_enabled = false;
*device = &adev->device.common;
- if (k_enable_extended_precision)
- adev_verify_devices(adev);
audio_extn_utils_update_streams_output_cfg_list(adev->platform, adev->mixer,
&adev->streams_output_cfg_list);
@@ -3590,6 +3588,9 @@ static int adev_open(const hw_module_t *module, const char *name,
}
}
+ if (k_enable_extended_precision)
+ adev_verify_devices(adev);
+
pthread_mutex_unlock(&adev_init_lock);
ALOGV("%s: exit", __func__);