summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Stefani <luca.stefani.ge1@gmail.com>2020-03-07 13:23:12 +0100
committerLuca Stefani <luca.stefani.ge1@gmail.com>2020-03-07 13:23:12 +0100
commit722c28c2312bf9803ebd5828d0571157f47055f3 (patch)
treebe3429351f41861e0370d7d3c5cd4c7347ad461e
parent0b782613f00e89da1f319db36e28dfd20e0b9388 (diff)
parent6f8cba99a1338c70a57b639a5ee9545a180c9f48 (diff)
downloadandroid_hardware_qcom_audio-lineage-17.1.tar.gz
android_hardware_qcom_audio-lineage-17.1.tar.bz2
android_hardware_qcom_audio-lineage-17.1.zip
Merge tag 'android-10.0.0_r31' into lineage-17.1-android-10.0.0_r31lineage-17.1
Android 10.0.0 release 31 * tag 'android-10.0.0_r31': audio: free and assign NULL to global static device pointer post_proc: release vol listener object based on context audio: free and assign NULL to global static device pointer Change-Id: Ie4f5f97dcba429e6133f8c1c4c6b3538d1a9c8d3
-rw-r--r--hal/audio_hw.c5
-rw-r--r--post_proc/volume_listener.c21
2 files changed, 7 insertions, 19 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 1c99066f..dabc4116 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -6288,6 +6288,8 @@ static int adev_close(hw_device_t *device)
return 0;
pthread_mutex_lock(&adev_init_lock);
+ if (!device || ((struct audio_device *)device != adev))
+ goto done;
if ((--audio_device_ref_count) == 0) {
audio_extn_snd_mon_unregister_listener(adev);
@@ -6306,10 +6308,11 @@ static int adev_close(hw_device_t *device)
adev->adm_deinit(adev->adm_data);
pthread_mutex_destroy(&adev->lock);
free(device);
+ adev = NULL;
}
+done:
pthread_mutex_unlock(&adev_init_lock);
-
return 0;
}
diff --git a/post_proc/volume_listener.c b/post_proc/volume_listener.c
index ea26860d..f356cffc 100644
--- a/post_proc/volume_listener.c
+++ b/post_proc/volume_listener.c
@@ -764,9 +764,6 @@ static int vol_prc_lib_release(effect_handle_t handle)
int status = -EINVAL;
bool recompute_flag = false;
int active_stream_count = 0;
- uint32_t session_id;
- uint32_t stream_type;
- effect_uuid_t uuid;
ALOGV("%s context %p", __func__, handle);
@@ -774,32 +771,20 @@ static int vol_prc_lib_release(effect_handle_t handle)
return status;
}
pthread_mutex_lock(&vol_listner_init_lock);
- session_id = recv_contex->session_id;
- stream_type = recv_contex->stream_type;
-
- if (recv_contex->desc == NULL) {
- ALOGE("%s: Got NULL descriptor, session %u, stream type %u",
- __func__, session_id, stream_type);
- dump_list_l();
- pthread_mutex_unlock(&vol_listner_init_lock);
- return status;
- }
- uuid = recv_contex->desc->uuid;
// check if the handle/context provided is valid
list_for_each_safe(node, temp_node_next, &vol_effect_list) {
context = node_to_item(node, struct vol_listener_context_s, effect_list_node);
- if ((memcmp(&(context->desc->uuid), &uuid, sizeof(effect_uuid_t)) == 0)
- && (context->session_id == session_id)
- && (context->stream_type == stream_type)) {
+ if (context == recv_contex) {
ALOGV("--- Found something to remove ---");
- list_remove(node);
PRINT_STREAM_TYPE(context->stream_type);
if (valid_dev_in_context(context)) {
recompute_flag = true;
}
+ list_remove(&context->effect_list_node);
free(context);
status = 0;
+ break;
} else {
++active_stream_count;
}