summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2012-06-15 14:49:21 -0700
committerEric Laurent <elaurent@google.com>2012-06-19 08:34:32 -0700
commit1a1c31e0a4058cedfee6120ace1d2938ac56230f (patch)
tree044834e0d7171cb5eb5c0f9e135e8c0c9655cc10
parent484c57172ed9653e0eef54c036498addb7f5e556 (diff)
downloaddevice_samsung_tuna-1a1c31e0a4058cedfee6120ace1d2938ac56230f.zip
device_samsung_tuna-1a1c31e0a4058cedfee6120ace1d2938ac56230f.tar.gz
device_samsung_tuna-1a1c31e0a4058cedfee6120ace1d2938ac56230f.tar.bz2
audio: acquire lock in adev_set_voice_volume()
Acquire the audio device mutex before calling into ril library in adev_set_voice_volume() to avoid concurrency with other calls to ril from select_mode() or set_incall_device(). Bug 6626532. Change-Id: I2347477b39ce46137a654047266b70dd691c021c
-rw-r--r--audio/audio_hw.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 74f2383..d377f2b 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -1142,7 +1142,7 @@ static void select_mode(struct tuna_audio_device *adev)
adev->devices &= ~AUDIO_DEVICE_OUT_SPEAKER;
select_output_device(adev);
start_call(adev);
- adev_set_voice_volume(&adev->hw_device, adev->voice_volume);
+ ril_set_call_volume(&adev->ril, SOUND_TYPE_VOICE, adev->voice_volume);
adev->in_call = 1;
}
} else {
@@ -3408,11 +3408,13 @@ static int adev_set_voice_volume(struct audio_hw_device *dev, float volume)
{
struct tuna_audio_device *adev = (struct tuna_audio_device *)dev;
+ pthread_mutex_lock(&adev->lock);
adev->voice_volume = volume;
if (adev->mode == AUDIO_MODE_IN_CALL)
ril_set_call_volume(&adev->ril, SOUND_TYPE_VOICE, volume);
+ pthread_mutex_unlock(&adev->lock);
return 0;
}