hal : Fix for stability offload issues.

-Disable and enable the device seperately from
 check_usecases_codec_backend function.
-Acquire device lock for pcm close. This prevents crash during
 headset device switch and fast forward.
-hw free is getting called from compress framework while runtime
 update is going on. The front end list could be cleared during
 runtime update and concurrent access of front end list could
 result a crash.

CRs-Fixed: 568710
Change-Id: Iccc2b9d3c175a5421cfc4d070b0af3906d9080c5
This commit is contained in:
Krishnankutty Kolathappilly 2013-11-01 20:07:13 -07:00 committed by Gerrit - the friendly Code Review server
parent ac203d58b0
commit dc4f757fac
1 changed files with 8 additions and 3 deletions

View File

@ -358,10 +358,15 @@ static void check_usecases_codec_backend(struct audio_device *adev,
usecase = node_to_item(node, struct audio_usecase, list);
if (switch_device[usecase->id]) {
disable_snd_device(adev, usecase->out_snd_device, false);
enable_snd_device(adev, snd_device, false);
}
}
list_for_each(node, &adev->usecase_list) {
usecase = node_to_item(node, struct audio_usecase, list);
if (switch_device[usecase->id]) {
enable_snd_device(adev, snd_device, false);
}
}
/* Make sure new snd device is enabled before re-routing the streams */
audio_route_update_mixer(adev->audio_route);
@ -1198,6 +1203,7 @@ static int out_standby(struct audio_stream *stream)
out->usecase, use_case_table[out->usecase]);
pthread_mutex_lock(&out->lock);
pthread_mutex_lock(&adev->lock);
if (!out->standby) {
out->standby = true;
if (out->usecase != USECASE_AUDIO_PLAYBACK_OFFLOAD) {
@ -1214,10 +1220,9 @@ static int out_standby(struct audio_stream *stream)
out->compr = NULL;
}
}
pthread_mutex_lock(&adev->lock);
stop_output_stream(out);
pthread_mutex_unlock(&adev->lock);
}
pthread_mutex_unlock(&adev->lock);
pthread_mutex_unlock(&out->lock);
ALOGV("%s: exit", __func__);
return 0;