audio: Prevent invalidation of second input stream am: 8ea0472595
am: 2bd1f60677
Change-Id: Ie3c394137a59c0cbe044d636fd8027c1c51af86f
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index c4e7717..9e56286 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1340,10 +1340,20 @@
struct audio_usecase *uc_info;
struct audio_device *adev = in->dev;
- adev->active_input = NULL;
-
ALOGV("%s: enter: usecase(%d: %s)", __func__,
in->usecase, use_case_table[in->usecase]);
+
+ if (adev->active_input) {
+ if (adev->active_input->usecase == in->usecase) {
+ adev->active_input = NULL;
+ } else {
+ ALOGW("%s adev->active_input->usecase %s, v/s in->usecase %s",
+ __func__,
+ use_case_table[adev->active_input->usecase],
+ use_case_table[in->usecase]);
+ }
+ }
+
uc_info = get_usecase_from_list(adev, in->usecase);
if (uc_info == NULL) {
ALOGE("%s: Could not find the usecase (%d) in the list",
@@ -3097,7 +3107,7 @@
if (ret >= 0) {
val = atoi(value);
- if (((int)in->device != val) && (val != 0)) {
+ if (((int)in->device != val) && (val != 0) && audio_is_input_device(val) ) {
in->device = val;
/* If recording is in progress, change the tx device to new device */
if (!in->standby) {