summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2022-06-22 06:24:46 -0700
committerLinux Build Service Account <lnxbuild@localhost>2022-06-22 06:24:46 -0700
commitec4dd9757fad0815f5929a96d14c1eff0736c152 (patch)
tree830d7fec0ef0fc291a5107721d9248cc2156c137
parent4e9b5e2df1bcaa0135ccbb6138e85f9e7987ba3b (diff)
parent8f494538d093642f4fafd30d1eec92e3b3ce702c (diff)
Merge 8f494538d093642f4fafd30d1eec92e3b3ce702c on remote branch
Change-Id: Ifd183b6acd67b5a52019d895c9af6452226a0d0b
-rw-r--r--[-rwxr-xr-x]hal/Android.mk0
-rw-r--r--hal/AudioDevice.cpp21
-rw-r--r--hal/AudioStream.cpp6
-rw-r--r--hal/audio_extn/AudioExtn.cpp3
4 files changed, 22 insertions, 8 deletions
diff --git a/hal/Android.mk b/hal/Android.mk
index 0b075dfb..0b075dfb 100755..100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
diff --git a/hal/AudioDevice.cpp b/hal/AudioDevice.cpp
index 5ea2666e..bd7afbd2 100644
--- a/hal/AudioDevice.cpp
+++ b/hal/AudioDevice.cpp
@@ -2,6 +2,9 @@
* Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Not a Contribution.
+ *
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -1420,7 +1423,8 @@ int AudioDevice::SetParameters(const char *kvpairs) {
pal_device_count = GetPalDeviceIds({device}, pal_device_ids);
ret = add_input_headset_if_usb_out_headset(&pal_device_count, &pal_device_ids);
if (ret) {
- free(pal_device_ids);
+ if (pal_device_ids)
+ free(pal_device_ids);
AHAL_ERR("adding input headset failed, error:%d", ret);
goto exit;
}
@@ -1451,8 +1455,8 @@ int AudioDevice::SetParameters(const char *kvpairs) {
ret = pal_get_param(PAL_PARAM_ID_DEVICE_CAPABILITY,
(void **)&device_cap_query,
&payload_size, nullptr);
- if (dynamic_media_config.sample_rate == 0 && dynamic_media_config.format == 0 &&
- dynamic_media_config.mask == 0)
+ if ((dynamic_media_config.sample_rate == 0 && dynamic_media_config.format == 0 &&
+ dynamic_media_config.mask == 0) || (dynamic_media_config.jack_status == false))
usb_input_dev_enabled = false;
free(device_cap_query);
} else {
@@ -1609,6 +1613,13 @@ int AudioDevice::SetParameters(const char *kvpairs) {
if (device) {
pal_device_ids = (pal_device_id_t *) calloc(1, sizeof(pal_device_id_t));
pal_device_count = GetPalDeviceIds({device}, pal_device_ids);
+ ret = add_input_headset_if_usb_out_headset(&pal_device_count, &pal_device_ids);
+ if (ret) {
+ if (pal_device_ids)
+ free(pal_device_ids);
+ AHAL_ERR("adding input headset failed, error:%d", ret);
+ goto exit;
+ }
for (int i = 0; i < pal_device_count; i++) {
param_device_connection.connection_state = false;
param_device_connection.id = pal_device_ids[i];
@@ -1620,10 +1631,6 @@ int AudioDevice::SetParameters(const char *kvpairs) {
}
AHAL_INFO("pal set param sucess for device disconnect");
}
- if (pal_device_ids) {
- free(pal_device_ids);
- pal_device_ids = NULL;
- }
}
}
diff --git a/hal/AudioStream.cpp b/hal/AudioStream.cpp
index 5b42b8fd..c10b5bf5 100644
--- a/hal/AudioStream.cpp
+++ b/hal/AudioStream.cpp
@@ -1553,6 +1553,9 @@ pal_stream_type_t StreamInPrimary::GetPalStreamType(
return palStreamType;
} else if (source_ == AUDIO_SOURCE_VOICE_RECOGNITION) {
palStreamType = PAL_STREAM_VOICE_RECOGNITION;
+ if (halStreamFlags & AUDIO_INPUT_FLAG_MMAP_NOIRQ) {
+ palStreamType = PAL_STREAM_ULTRA_LOW_LATENCY;
+ }
return palStreamType;
}
@@ -2172,7 +2175,8 @@ int StreamOutPrimary::SetParameters(struct str_parms *parms) {
if (ret >= 0) {
adevice->dp_controller = controller;
adevice->dp_stream = stream;
- AHAL_INFO("ret %d, plugin device cont %d stream %d", ret, controller, stream);
+ if (stream >= 0 || controller >= 0)
+ AHAL_INFO("ret %d, plugin device cont %d stream %d", ret, controller, stream);
} else {
AHAL_ERR("error %d, failed to get stream and controller", ret);
}
diff --git a/hal/audio_extn/AudioExtn.cpp b/hal/audio_extn/AudioExtn.cpp
index e7c2f573..608331e1 100644
--- a/hal/audio_extn/AudioExtn.cpp
+++ b/hal/audio_extn/AudioExtn.cpp
@@ -371,6 +371,9 @@ int AudioExtn::get_controller_stream_from_params(struct str_parms *parms,
*stream = 0;
return -EINVAL;
}
+ } else {
+ *controller = -1;
+ *stream = -1;
}
return 0;
}