Promotion of audio-userspace.lnx.2.1-00044.

CRs      Change ID                                   Subject
--------------------------------------------------------------------------------------------------------------
1082983   If4c09807e833584c8804b9ac65b1353ba53fa9a5   configs: msmcobalt: Update SoundTrigger platform xml
1076923   I5fafaa71d13ce234908dc2e24979d69a38435f62   hal: Fix for a native crash in select_devices

Change-Id: Ia8581c5bb0ca70b2d586f9eda3b4fcc36d5a6f96
CRs-Fixed: 1076923, 1082983
diff --git a/configs/msmcobalt/sound_trigger_platform_info.xml b/configs/msmcobalt/sound_trigger_platform_info.xml
index 6c9f55e..15c8ef6 100644
--- a/configs/msmcobalt/sound_trigger_platform_info.xml
+++ b/configs/msmcobalt/sound_trigger_platform_info.xml
@@ -50,7 +50,13 @@
         <param max_cpe_users="3" />
         <param max_ape_phrases="10" />
         <param max_ape_users="10" />
+        <!-- Profile specific data which the algorithm can support -->
         <param sample_rate="16000" />
+        <param bit_width="16" />
+        <param channel_count="1"/>
+        <!-- adm_cfg_profile should match with the one defined under adm_config -->
+        <!-- Set it to NONE if LSM directly connects to AFE -->
+        <param adm_cfg_profile="NONE" />
         <gcs_usecase>
             <param uid="0x1" />
             <!-- module_id, instance_id, param_id -->
@@ -82,4 +88,13 @@
         <param capture_keyword="PCM_packet, RT, 2000" />
         <param client_capture_read_delay="2000" />
     </sound_model_config>
+
+    <!-- Multiple adm_config tags can be listed, each with unique profile name. -->
+    <!-- app_type to match corresponding value from ACDB -->
+    <adm_config>
+        <param adm_cfg_profile="DEFAULT" />
+        <param app_type="69938" />
+        <param sample_rate="16000" />
+        <param bit_width="16" />
+    </adm_config>
 </sound_trigger_platform_info>
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 8fa6d88..13e4ae9 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1334,6 +1334,10 @@
     if ((usecase->type == VOICE_CALL) ||
         (usecase->type == VOIP_CALL)  ||
         (usecase->type == PCM_HFP_CALL)) {
+        if(usecase->stream.out == NULL) {
+            ALOGE("%s: stream.out is NULL", __func__);
+            return -EINVAL;
+        }
         out_snd_device = platform_get_output_snd_device(adev->platform,
                                                         usecase->stream.out);
         in_snd_device = platform_get_input_snd_device(adev->platform, usecase->stream.out->devices);
@@ -1377,6 +1381,10 @@
             }
         }
         if (usecase->type == PCM_PLAYBACK) {
+            if (usecase->stream.out == NULL) {
+                ALOGE("%s: stream.out is NULL", __func__);
+                return -EINVAL;
+            }
             usecase->devices = usecase->stream.out->devices;
             in_snd_device = SND_DEVICE_NONE;
             if (out_snd_device == SND_DEVICE_NONE) {
@@ -1389,6 +1397,10 @@
                 }
             }
         } else if (usecase->type == PCM_CAPTURE) {
+            if (usecase->stream.in == NULL) {
+                ALOGE("%s: stream.in is NULL", __func__);
+                return -EINVAL;
+            }
             usecase->devices = usecase->stream.in->device;
             out_snd_device = SND_DEVICE_NONE;
             if (in_snd_device == SND_DEVICE_NONE) {